api: fix bugs introduced in code cleanup
This commit is contained in:
parent
4732681864
commit
49c761311b
|
@ -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');
|
||||
|
|
|
@ -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){
|
||||
|
|
Loading…
Reference in New Issue