Add: report whether backup path environment is set

This commit is contained in:
Nicholas Wallace 2024-07-05 17:27:49 +00:00
parent b01ef1c691
commit 37f62d22b6
3 changed files with 10 additions and 1 deletions

View File

@ -10,7 +10,8 @@ class BackupController {
getAll(req, res) { getAll(req, res) {
res.json({ res.json({
backups: this.backupManager.backups.map((b) => b.toJSON()), backups: this.backupManager.backups.map((b) => b.toJSON()),
backupLocation: this.backupManager.backupPath backupLocation: this.backupManager.backupPath,
backupEnvSet: this.backupManager.backupPathEnvSet
}) })
} }

View File

@ -29,6 +29,10 @@ class BackupManager {
return global.ServerSettings.backupPath return global.ServerSettings.backupPath
} }
get backupPathEnvSet() {
return global.ServerSettings.backupPathEnvSet
}
get backupSchedule() { get backupSchedule() {
return global.ServerSettings.backupSchedule return global.ServerSettings.backupSchedule
} }

View File

@ -26,6 +26,7 @@ class ServerSettings {
this.rateLimitLoginWindow = 10 * 60 * 1000 // 10 Minutes this.rateLimitLoginWindow = 10 * 60 * 1000 // 10 Minutes
// Backups // Backups
this.backupPathEnvSet = false
this.backupPath = Path.join(global.MetadataPath, 'backups') this.backupPath = Path.join(global.MetadataPath, 'backups')
this.backupSchedule = false // If false then auto-backups are disabled this.backupSchedule = false // If false then auto-backups are disabled
this.backupsToKeep = 2 this.backupsToKeep = 2
@ -188,6 +189,8 @@ class ServerSettings {
Logger.info(`[ServerSettings] Using backup path from environment variable ${process.env.BACKUP_PATH}`) Logger.info(`[ServerSettings] Using backup path from environment variable ${process.env.BACKUP_PATH}`)
this.backupPath = process.env.BACKUP_PATH this.backupPath = process.env.BACKUP_PATH
} }
this.backupPathEnvSet = !!settings.process.env.BACKUP_PATH || false
} }
toJSON() { toJSON() {
@ -206,6 +209,7 @@ class ServerSettings {
rateLimitLoginRequests: this.rateLimitLoginRequests, rateLimitLoginRequests: this.rateLimitLoginRequests,
rateLimitLoginWindow: this.rateLimitLoginWindow, rateLimitLoginWindow: this.rateLimitLoginWindow,
backupPath: this.backupPath, backupPath: this.backupPath,
backupPathEnvSet: this.backupPathEnvSet,
backupSchedule: this.backupSchedule, backupSchedule: this.backupSchedule,
backupsToKeep: this.backupsToKeep, backupsToKeep: this.backupsToKeep,
maxBackupSize: this.maxBackupSize, maxBackupSize: this.maxBackupSize,