mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-01-27 15:11:47 +00:00
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>
This commit is contained in:
parent
140b2c261c
commit
aece96f539
1 changed files with 11 additions and 4 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
|
@ -31,7 +30,7 @@ const packageConfig = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const configFilePath = path.resolve(appRootPath, process.env.CMD_CONFIG_FILE ||
|
const configFilePath = path.resolve(appRootPath, process.env.CMD_CONFIG_FILE ||
|
||||||
'config.json')
|
'config.json')
|
||||||
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
|
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
|
||||||
|
|
||||||
let config = require('./default')
|
let config = require('./default')
|
||||||
|
@ -88,6 +87,14 @@ config.isStandardHTTPPort = (function isStandardHTTPPort () {
|
||||||
return !config.useSSL && config.port === 80
|
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
|
// cache serverURL
|
||||||
config.serverURL = (function getserverurl () {
|
config.serverURL = (function getserverurl () {
|
||||||
let url = ''
|
let url = ''
|
||||||
|
@ -147,8 +154,8 @@ for (let i = keys.length; i--;) {
|
||||||
// and the config with uppercase is not set
|
// and the config with uppercase is not set
|
||||||
// we set the new config using the old key.
|
// we set the new config using the old key.
|
||||||
if (uppercase.test(keys[i]) &&
|
if (uppercase.test(keys[i]) &&
|
||||||
config[lowercaseKey] !== undefined &&
|
config[lowercaseKey] !== undefined &&
|
||||||
fileConfig[keys[i]] === 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])
|
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]
|
config[keys[i]] = config[lowercaseKey]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue