diff options
Diffstat (limited to 'lib/config.js')
-rw-r--r-- | lib/config.js | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/config.js b/lib/config.js index f74faa9..2c9b9fc 100644 --- a/lib/config.js +++ b/lib/config.js @@ -24,7 +24,7 @@ See the License for the specific language governing permissions and limitations * -------------------------------------------------------------------------------------- * | JSON property | Environment variable | Required? | Default | * -------------------------------------------------------------------------------------- - * | foreground | FOREGROUND | Yes | true | + * | foreground | FOREGROUND | Yes | false | * -------------------------------------------------------------------------------------- * | logLevel | LOG_LEVEL | Yes | "INFO" | * -------------------------------------------------------------------------------------- @@ -49,13 +49,19 @@ See the License for the specific language governing permissions and limitations * | inventory.password | INVENTORY_PASSWORD | No | none | * -------------------------------------------------------------------------------------- * + * cloudify.cfyManagerAddress allowed as synonym for cloudify.url + * cloudify.cfyUser allowed as synonym for cloudify.user + * cloudify.cfyPassword allowed as synonym for cloudify.password + * inventory.inventoryAddress allowed as synonym for inventory.url + * ssl.pfx-file allowed as synonym for ssl.pfxFile + * Note that we're using ssl.passphrase directly in the config file--i.e., we get the passphrase, not a file. */ "use strict"; const fs = require("fs"); const utils = require("./utils"); -const DEFAULT_FOREGROUND = true; +const DEFAULT_FOREGROUND = false; const DEFAULT_LISTEN_PORT = 8443; const DEFAULT_LISTEN_HOST = "0.0.0.0"; const DEFAULT_LOG_LEVEL = "INFO"; @@ -96,19 +102,22 @@ exports.configure = function(configFile) { if (!cfg.cloudify) { cfg.cloudify = {}; } - cfg.cloudify.url = process.env['CLOUDIFY_URL'] || cfg.cloudify.url; - cfg.cloudify.user = process.env['CLOUDIFY_USER'] || cfg.cloudify.user; - cfg.cloudify.password = process.env['CLOUDIFY_PASSWORD'] || cfg.cloudify.password; + cfg.cloudify.url = process.env['CLOUDIFY_URL'] || cfg.cloudify.url || cfg.cloudify.cfyManagerAddress; + cfg.cloudify.user = process.env['CLOUDIFY_USER'] || cfg.cloudify.user || cfg.cloudify.cfyUser; + cfg.cloudify.password = process.env['CLOUDIFY_PASSWORD'] || cfg.cloudify.password || cfg.cloudify.cfyPassword; if (!cfg.inventory) { cfg.inventory = {}; } - cfg.inventory.url = process.env['INVENTORY_URL'] || cfg.inventory.url || DEFAULT_INVENTORY_URL; + cfg.inventory.url = process.env['INVENTORY_URL'] || cfg.inventory.url || cfg.inventory.inventoryAddress || DEFAULT_INVENTORY_URL; cfg.inventory.user = process.env['INVENTORY_USER'] || cfg.inventory.user; cfg.inventory.password = process.env['INVENTORY_PASSWORD'] || cfg.inventory.password; cfg.locations = {}; /* If https params are present, read in the cert/passphrase */ + if (cfg.ssl) { + cfg.ssl.pfxFile = cfg.ssl.pfxFile || cfg.ssl['pfx-file']; // Allow synonym + } if (cfg.ssl && cfg.ssl.pfxFile) { cfg.ssl.pfx = fs.readFileSync(cfg.ssl.pfxFile); if (cfg.ssl.pfxPassFile) { @@ -128,7 +137,7 @@ exports.configure = function(configFile) { /** Read locations file */ exports.getLocations = function(locationsFile) { - let locations = {}; + var locations = {}; try { locations = JSON.parse(fs.readFileSync(locationsFile)); |