Log only non-default config
This commit is contained in:
1 parent
6bfe590b0d
commit
ec57131d51
2 files changed
+18
-2
No files matched your search
+8
-2
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
const cluster = require("cluster");
|
const cluster = require("cluster");
|
||||||
const logger = require("./logger");
|
const logger = require("./logger");
|
||||||
|
const config = require("./config");
|
||||||
|
|
||||||
const VERSION = require("../package.json").version;
|
const VERSION = require("../package.json").version;
|
||||||
|
|
||||||
@@ -41,8 +42,13 @@ function getConfig() {
|
|||||||
let conf = [];
|
let conf = [];
|
||||||
const keys = Object.keys(process.env);
|
const keys = Object.keys(process.env);
|
||||||
for (let k of keys)
|
for (let k of keys)
|
||||||
if (k.startsWith("GENIEACS_"))
|
if (k.startsWith("GENIEACS_")) {
|
||||||
conf.push(`${k.slice(9)}=${process.env[k]}`);
|
const name = k.slice(9);
|
||||||
|
const value = process.env[k];
|
||||||
|
const def = config.getDefault(name);
|
||||||
|
if (def == null || value !== `${def}`)
|
||||||
|
conf.push(`${name}=${value}`);
|
||||||
|
}
|
||||||
|
|
||||||
return conf.join(",");
|
return conf.join(",");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,8 +190,18 @@ get = (option, deviceId) ->
|
|||||||
return allConfig[option]
|
return allConfig[option]
|
||||||
|
|
||||||
|
|
||||||
|
getDefault = (optionName) ->
|
||||||
|
option = options[optionName]
|
||||||
|
return null if not option
|
||||||
|
val = option.default
|
||||||
|
if val and option.type == 'path'
|
||||||
|
val = path.resolve(val)
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
# load authentication scripts
|
# load authentication scripts
|
||||||
try
|
try
|
||||||
exports.auth = require(path.resolve(allConfig.CONFIG_DIR, 'auth'))
|
exports.auth = require(path.resolve(allConfig.CONFIG_DIR, 'auth'))
|
||||||
|
|
||||||
exports.get = get
|
exports.get = get
|
||||||
|
exports.getDefault = getDefault
|
||||||
Reference in new issue
Block a user