mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-29 07:08:56 +00:00
This commit is contained in:
+10
-1
@@ -2,6 +2,15 @@ const yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
const data = require('./data');
|
||||
const file = data.joinPath('configuration.yaml');
|
||||
const objectAssignDeep = require(`object-assign-deep`);
|
||||
const path = require('path');
|
||||
|
||||
const defaults = {
|
||||
advanced: {
|
||||
log_directory: path.join(data.getPath(), 'log', '%TIMESTAMP%'),
|
||||
log_level: process.env.DEBUG ? 'debug' : 'info',
|
||||
},
|
||||
};
|
||||
|
||||
let settings = read();
|
||||
|
||||
@@ -57,7 +66,7 @@ function changeFriendlyName(old, new_) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
get: () => settings,
|
||||
get: () => objectAssignDeep.noMutate(defaults, settings),
|
||||
write: () => write(),
|
||||
getDevice: (id) => settings.devices ? settings.devices[id] : null,
|
||||
addDevice: (id) => addDevice(id),
|
||||
|
||||
Reference in New Issue
Block a user