Skip to content

Commit

Permalink
Update backups config page to use backupPathEnvSet returned from endp…
Browse files Browse the repository at this point in the history
…oint, remove from ServerConfig
  • Loading branch information
advplyr committed Jul 5, 2024
1 parent a168848 commit 7c0b4e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/components/tables/BackupsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
12 changes: 7 additions & 5 deletions client/pages/config/backups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default {
newServerSettings: {},
showCronBuilder: false,
showEditBackupPath: false,
backupPathEnvSet: false,
backupLocation: '',
newBackupLocation: '',
savingBackupPath: false
Expand All @@ -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 ''
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/managers/BackupManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BackupManager {
}

get backupPathEnvSet() {
return global.ServerSettings.backupPathEnvSet
return !!process.env.BACKUP_PATH
}

get backupSchedule() {
Expand Down
4 changes: 0 additions & 4 deletions server/objects/settings/ServerSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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,
Expand Down

0 comments on commit 7c0b4e3

Please sign in to comment.