summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Mehren2021-05-04 11:51:06 +0200
committerDavid Mehren2021-05-06 21:19:14 +0200
commitaece96f53909c3945b66b1f2f726b07b5fb6489f (patch)
tree7d1a5e149876dbf8d9818b31890e9129518098ea /lib
parent140b2c261c578c414f8251fe577ea996cb02dfc9 (diff)
Automatically enable protocolUseSSL when useSSL is set
This makes the behavior consistent with the docs and saves the user from having to both set `useSSL` and `protocolUseSSL`. Signed-off-by: David Mehren <git@herrmehren.de>
Diffstat (limited to '')
-rw-r--r--lib/config/index.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/config/index.js b/lib/config/index.js
index 48e61b6c..bdbdfea9 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -1,4 +1,3 @@
-
'use strict'
const crypto = require('crypto')
@@ -31,7 +30,7 @@ const packageConfig = {
}
const configFilePath = path.resolve(appRootPath, process.env.CMD_CONFIG_FILE ||
-'config.json')
+ 'config.json')
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
let config = require('./default')
@@ -88,6 +87,14 @@ config.isStandardHTTPPort = (function isStandardHTTPPort () {
return !config.useSSL && config.port === 80
})()
+// Use HTTPS protocol if the internal TLS server is enabled
+if (config.useSSL === true) {
+ if (config.protocolUseSSL === false) {
+ logger.warn('Overriding protocolUseSSL to \'true\' as useSSL is enabled.')
+ }
+ config.protocolUseSSL = true
+}
+
// cache serverURL
config.serverURL = (function getserverurl () {
let url = ''
@@ -147,8 +154,8 @@ for (let i = keys.length; i--;) {
// and the config with uppercase is not set
// we set the new config using the old key.
if (uppercase.test(keys[i]) &&
- config[lowercaseKey] !== undefined &&
- fileConfig[keys[i]] === undefined) {
+ config[lowercaseKey] !== undefined &&
+ fileConfig[keys[i]] === undefined) {
logger.warn('config.json contains deprecated lowercase setting for ' + keys[i] + '. Please change your config.json file to replace ' + lowercaseKey + ' with ' + keys[i])
config[keys[i]] = config[lowercaseKey]
}