diff --git a/api/src/config.js b/api/src/config.js index 27cb1e9..6d73f54 100644 --- a/api/src/config.js +++ b/api/src/config.js @@ -129,11 +129,11 @@ function make_default_config(){ content.concat(option.desc.split('\n').map(x=>`# ${x}`)); if(option.options) - content.append('# Options: ' + option.options.join(', ')); + content.push('# Options: ' + option.options.join(', ')); - content.append(`${option.key}: ${option.default}`); - - content.append(''); // New line between + content.push(`${option.key}: ${option.default}`); + + content.push(''); // New line between }); return content.join('\n'); diff --git a/api/src/state.js b/api/src/state.js index b69d626..dd6f773 100644 --- a/api/src/state.js +++ b/api/src/state.js @@ -30,12 +30,12 @@ module.exports = { async load(data_file){ if(fss.exists_sync(data_file)){ logger.info('Loading state from file'); - - const content = await fs.read_file(data_file); - const obj = JSON.parse(content.toString(), reviver); + var content = await fs.read_file(data_file); + var obj = JSON.parse(content.toString(), reviver); [...obj.keys()].forEach(k => state.set(k, obj.get(k))); }else{ logger.info('Creating new state file'); + state.set('repositories', new Map()); } }, async save(data_file){