fix(config): fixed saving configuration on develop builds

This commit is contained in:
Alexey Kasyanchuk
2018-02-05 21:25:39 +03:00
parent c4284ca543
commit 9a99803c68
2 changed files with 21 additions and 14 deletions

View File

@ -36,7 +36,9 @@ let config = {
trafficInterface: 'enp2s0',
trafficMax: 0,
trafficUpdateTime: 3, //secs
trafficIgnoreDHT: false
trafficIgnoreDHT: false,
dbPath: '',
}
const fs = require('fs');
@ -59,7 +61,8 @@ const configProxy = new Proxy(config, {
let obj = JSON.parse(data)
obj[prop] = value;
fs.writeFileSync(configPath, JSON.stringify(obj, null, 4), 'utf8');
debug('saving config.json:', prop, '=', value)
debug('saving rats.json:', prop, '=', value)
return true
}
})
@ -73,7 +76,7 @@ config.load = () => {
for(let prop in obj)
{
config[prop] = obj[prop]
debug('config.json:', prop, '=', obj[prop])
debug('rats.json:', prop, '=', obj[prop])
}
}
return configProxy