backups: move limits into a sub object

fixes #817
This commit is contained in:
Girish Ramakrishnan
2023-07-13 11:50:57 +05:30
parent 1a5cbfb2a1
commit c86059e070
13 changed files with 66 additions and 68 deletions
-18
View File
@@ -29,7 +29,6 @@ exports = module.exports = {
getBackupConfig,
setBackupConfig,
setBackupCredentials,
getServicesConfig,
setServicesConfig,
@@ -485,23 +484,6 @@ async function setBackupConfig(backupConfig) {
notifyChange(exports.BACKUP_CONFIG_KEY, backupConfig);
}
async function setBackupCredentials(credentials) {
assert.strictEqual(typeof credentials, 'object');
const currentConfig = await getBackupConfig();
// preserve these fields
const extra = _.pick(currentConfig, 'copyConcurrency', 'syncConcurrency', 'memoryLimit', 'downloadConcurrency', 'deleteConcurrency', 'uploadPartSize');
const backupConfig = Object.assign({}, credentials, extra);
backups.cleanupCacheFilesSync();
await set(exports.BACKUP_CONFIG_KEY, JSON.stringify(backupConfig));
notifyChange(exports.BACKUP_CONFIG_KEY, backupConfig);
}
async function getServicesConfig() {
const value = await get(exports.SERVICES_CONFIG_KEY);
if (value === null) return gDefaults[exports.SERVICES_CONFIG_KEY];