mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-17 10:58:31 -07:00
24 lines
453 B
JavaScript
24 lines
453 B
JavaScript
|
const yamlConfig = require('yaml-config');
|
||
|
const file = `${__dirname}/../../data/configuration.yaml`;
|
||
|
let settings = read();
|
||
|
|
||
|
// Create empty device array if not set yet.
|
||
|
if (!settings.devices) {
|
||
|
settings.devices = {};
|
||
|
write();
|
||
|
}
|
||
|
|
||
|
function write() {
|
||
|
yamlConfig.updateConfig(settings, file, 'user');
|
||
|
settings = read();
|
||
|
}
|
||
|
|
||
|
function read() {
|
||
|
return yamlConfig.readConfig(file, 'user');
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports = {
|
||
|
get: () => settings,
|
||
|
}
|