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
|
skipContentCheck: false
|
||||||
# Disable automatic chats backup
|
# Disable automatic chats backup
|
||||||
disableChatBackup: false
|
disableChatBackup: false
|
||||||
|
# Number of backups to keep for each chat and settings file
|
||||||
|
numberOfBackups: 50
|
||||||
# Allowed hosts for card downloads
|
# Allowed hosts for card downloads
|
||||||
whitelistImportDomains:
|
whitelistImportDomains:
|
||||||
- localhost
|
- localhost
|
||||||
|
|
|
@ -371,7 +371,7 @@ function generateTimestamp() {
|
||||||
* @param {string} prefix File prefix to filter backups by.
|
* @param {string} prefix File prefix to filter backups by.
|
||||||
*/
|
*/
|
||||||
function removeOldBackups(directory, prefix) {
|
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));
|
let files = fs.readdirSync(directory).filter(f => f.startsWith(prefix));
|
||||||
if (files.length > MAX_BACKUPS) {
|
if (files.length > MAX_BACKUPS) {
|
||||||
|
|
Loading…
Reference in New Issue