From ec57131d51f0d9f0b0bf67f0071e2893e6ac0bf2 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Sun, 12 Nov 2017 13:01:39 -0800 Subject: [PATCH] Log only non-default config --- lib/cluster.js | 10 ++++++++-- lib/config.coffee | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/cluster.js b/lib/cluster.js index 4f83ba2..19bafa9 100644 --- a/lib/cluster.js +++ b/lib/cluster.js @@ -20,6 +20,7 @@ const cluster = require("cluster"); const logger = require("./logger"); +const config = require("./config"); const VERSION = require("../package.json").version; @@ -41,8 +42,13 @@ function getConfig() { let conf = []; const keys = Object.keys(process.env); for (let k of keys) - if (k.startsWith("GENIEACS_")) - conf.push(`${k.slice(9)}=${process.env[k]}`); + if (k.startsWith("GENIEACS_")) { + 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(","); } diff --git a/lib/config.coffee b/lib/config.coffee index 74b5fc3..6aad77c 100644 --- a/lib/config.coffee +++ b/lib/config.coffee @@ -190,8 +190,18 @@ get = (option, deviceId) -> 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 try exports.auth = require(path.resolve(allConfig.CONFIG_DIR, 'auth')) exports.get = get +exports.getDefault = getDefault