add configProxy and update config.json
parent
1eb45bbe8c
commit
5d966f422a
@ -1,5 +1,16 @@
|
|||||||
import {DynDnsBot} from './DynDnsBot.js';
|
import {DynDnsBot} from './DynDnsBot.js';
|
||||||
import {loadData} from './jsonDataStore.js';
|
import {loadData, storeData} from './jsonDataStore.js';
|
||||||
|
|
||||||
let bot = new DynDnsBot({config: loadData('config.json')});
|
let configPath = 'config.json';
|
||||||
|
let config = loadData(configPath);
|
||||||
|
|
||||||
|
let configProxy = new Proxy(config, {
|
||||||
|
set: (target, key, value) => {
|
||||||
|
console.log(`config changed: ${key} set from ${target[key]} to ${value}`);
|
||||||
|
target[key] = value;
|
||||||
|
storeData(config, configPath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let bot = new DynDnsBot({config: configProxy});
|
||||||
bot.setInterval();
|
bot.setInterval();
|
Loading…
Reference in New Issue