fix autobackup: true

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-07-18 10:48:40 +01:00
parent aaad8b79cc
commit 62cae4cf8a
2 changed files with 7 additions and 4 deletions

View File

@ -818,8 +818,11 @@
] ]
}, },
"autoBackup": { "autoBackup": {
"type": "object", "type": [
"description": "Enable automatic backups of your meshcentral-data", "boolean",
"object"
],
"description": "If set to \"true\", automatic backups of your MeshCentral data will be enabled. Alternatively, you can provide an object with additional values such as \"webdav\", \"backupPath\", \"backupIntervalHours\", and more.",
"properties": { "properties": {
"mongoDumpPath": { "mongoDumpPath": {
"type": "string", "type": "string",

View File

@ -1957,9 +1957,9 @@ function CreateMeshCentralServer(config, args) {
obj.updateServerState('state', "running"); obj.updateServerState('state', "running");
// Setup auto-backup defaults // Setup auto-backup defaults
if (obj.config.settings.autobackup == null) { obj.config.settings.autobackup = { backupintervalhours: 24, keeplastdaysbackup: 10 }; } if (obj.config.settings.autobackup == null || obj.config.settings.autobackup === true) { obj.config.settings.autobackup = { backupintervalhours: 24, keeplastdaysbackup: 10 }; }
else if (obj.config.settings.autobackup === false) { delete obj.config.settings.autobackup; } else if (obj.config.settings.autobackup === false) { delete obj.config.settings.autobackup; }
else { else if (typeof obj.config.settings.autobackup == 'object'){
if (typeof obj.config.settings.autobackup.backupintervalhours != 'number') { obj.config.settings.autobackup.backupintervalhours = 24; } if (typeof obj.config.settings.autobackup.backupintervalhours != 'number') { obj.config.settings.autobackup.backupintervalhours = 24; }
if (typeof obj.config.settings.autobackup.keeplastdaysbackup != 'number') { obj.config.settings.autobackup.keeplastdaysbackup = 10; } if (typeof obj.config.settings.autobackup.keeplastdaysbackup != 'number') { obj.config.settings.autobackup.keeplastdaysbackup = 10; }
} }