Set the maximum number of backups via config
This commit is contained in:
parent
b3f657bed5
commit
ce18b33e73
|
@ -48,6 +48,8 @@ allowKeysExposure: false
|
|||
skipContentCheck: false
|
||||
# Disable automatic chats backup
|
||||
disableChatBackup: false
|
||||
# Number of backups to keep for each chat and settings file
|
||||
numberOfBackups: 50
|
||||
# Allowed hosts for card downloads
|
||||
whitelistImportDomains:
|
||||
- localhost
|
||||
|
|
|
@ -371,7 +371,7 @@ function generateTimestamp() {
|
|||
* @param {string} prefix File prefix to filter backups by.
|
||||
*/
|
||||
function removeOldBackups(directory, prefix) {
|
||||
const MAX_BACKUPS = 50;
|
||||
const MAX_BACKUPS = Number(getConfigValue('numberOfBackups', 50));
|
||||
|
||||
let files = fs.readdirSync(directory).filter(f => f.startsWith(prefix));
|
||||
if (files.length > MAX_BACKUPS) {
|
||||
|
|
Loading…
Reference in New Issue