Set the maximum number of backups via config
| @@ -48,6 +48,8 @@ allowKeysExposure: false | ||
| 48 | 48 | skipContentCheck: false |
| 49 | 49 | # Disable automatic chats backup |
| 50 | 50 | disableChatBackup: false |
| 51 | +# Number of backups to keep for each chat and settings file | |
| 52 | +numberOfBackups: 50 | |
| 51 | 53 | # Allowed hosts for card downloads |
| 52 | 54 | whitelistImportDomains: |
| 53 | 55 | - localhost |
| @@ -371,7 +371,7 @@ function generateTimestamp() { | ||
| 371 | 371 | * @param {string} prefix File prefix to filter backups by. |
| 372 | 372 | */ |
| 373 | 373 | function removeOldBackups(directory, prefix) { |
| 374 | 374 | const MAX_BACKUPS = Number(getConfigValue('numberOfBackups', 50)); |
| 375 | 375 | |
| 376 | 376 | let files = fs.readdirSync(directory).filter(f => f.startsWith(prefix)); |
| 377 | 377 | if (files.length > MAX_BACKUPS) { |