From 7c0b4e35d758c46639a1dddd494d27423ec36caa Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 5 Jul 2024 16:10:07 -0500 Subject: [PATCH] Update backups config page to use backupPathEnvSet returned from endpoint, remove from ServerConfig --- client/components/tables/BackupsTable.vue | 2 +- client/pages/config/backups.vue | 12 +++++++----- server/managers/BackupManager.js | 2 +- server/objects/settings/ServerSettings.js | 4 ---- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/client/components/tables/BackupsTable.vue b/client/components/tables/BackupsTable.vue index 380394bd..a8fbade6 100644 --- a/client/components/tables/BackupsTable.vue +++ b/client/components/tables/BackupsTable.vue @@ -171,7 +171,7 @@ export default { this.$axios .$get('/api/backups') .then((data) => { - this.$emit('loaded', data.backupLocation) + this.$emit('loaded', data) this.setBackups(data.backups || []) }) .catch((error) => { diff --git a/client/pages/config/backups.vue b/client/pages/config/backups.vue index 578ae6bd..7b64cbb2 100644 --- a/client/pages/config/backups.vue +++ b/client/pages/config/backups.vue @@ -92,6 +92,7 @@ export default { newServerSettings: {}, showCronBuilder: false, showEditBackupPath: false, + backupPathEnvSet: false, backupLocation: '', newBackupLocation: '', savingBackupPath: false @@ -116,8 +117,8 @@ export default { return this.serverSettings.timeFormat }, canEditBackup() { - // Prevent editing of backup path if an environement variable is set - return !this.serverSettings.backupPathEnvSet + // Prevent editing of backup path if an environment variable is set + return !this.backupPathEnvSet }, scheduleDescription() { if (!this.cronExpression) return '' @@ -131,9 +132,10 @@ export default { } }, methods: { - backupsLoaded(backupLocation) { - this.backupLocation = backupLocation - this.newBackupLocation = backupLocation + backupsLoaded(data) { + this.backupLocation = data.backupLocation + this.newBackupLocation = data.backupLocation + this.backupPathEnvSet = data.backupPathEnvSet }, cancelEditBackupPath() { this.newBackupLocation = this.backupLocation diff --git a/server/managers/BackupManager.js b/server/managers/BackupManager.js index ae79569c..88772c58 100644 --- a/server/managers/BackupManager.js +++ b/server/managers/BackupManager.js @@ -30,7 +30,7 @@ class BackupManager { } get backupPathEnvSet() { - return global.ServerSettings.backupPathEnvSet + return !!process.env.BACKUP_PATH } get backupSchedule() { diff --git a/server/objects/settings/ServerSettings.js b/server/objects/settings/ServerSettings.js index e5700a07..6ade11a9 100644 --- a/server/objects/settings/ServerSettings.js +++ b/server/objects/settings/ServerSettings.js @@ -26,7 +26,6 @@ class ServerSettings { this.rateLimitLoginWindow = 10 * 60 * 1000 // 10 Minutes // Backups - this.backupPathEnvSet = false this.backupPath = Path.join(global.MetadataPath, 'backups') this.backupSchedule = false // If false then auto-backups are disabled this.backupsToKeep = 2 @@ -189,8 +188,6 @@ class ServerSettings { Logger.info(`[ServerSettings] Using backup path from environment variable ${process.env.BACKUP_PATH}`) this.backupPath = process.env.BACKUP_PATH } - - this.backupPathEnvSet = !!process.env.BACKUP_PATH || false } toJSON() { @@ -209,7 +206,6 @@ class ServerSettings { rateLimitLoginRequests: this.rateLimitLoginRequests, rateLimitLoginWindow: this.rateLimitLoginWindow, backupPath: this.backupPath, - backupPathEnvSet: this.backupPathEnvSet, backupSchedule: this.backupSchedule, backupsToKeep: this.backupsToKeep, maxBackupSize: this.maxBackupSize,