api: fix bugs introduced in code cleanup

This commit is contained in:
Thomas Hobson 2021-03-06 00:31:51 +13:00
parent 4732681864
commit 49c761311b
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
2 changed files with 7 additions and 7 deletions

View File

@ -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.push(`${option.key}: ${option.default}`);
content.append(''); // New line between
content.push(''); // New line between
});
return content.join('\n');

View File

@ -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){