Skip to content

Commit

Permalink
fix autobackup: true
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 committed Jul 18, 2024
1 parent aaad8b7 commit 62cae4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions meshcentral-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,11 @@
]
},
"autoBackup": {
"type": "object",
"description": "Enable automatic backups of your meshcentral-data",
"type": [
"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": {
"mongoDumpPath": {
"type": "string",
Expand Down
4 changes: 2 additions & 2 deletions meshcentral.js
Original file line number Diff line number Diff line change
Expand Up @@ -1957,9 +1957,9 @@ function CreateMeshCentralServer(config, args) {
obj.updateServerState('state', "running");

// 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 {
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.keeplastdaysbackup != 'number') { obj.config.settings.autobackup.keeplastdaysbackup = 10; }
}
Expand Down

0 comments on commit 62cae4c

Please sign in to comment.