fix: setup incorrectly starting HTTPS server
This commit is contained in:
parent
9384ce14d5
commit
56235c6354
@ -380,32 +380,8 @@ module.exports = () => {
|
||||
|
||||
app.set('port', WIKI.config.port)
|
||||
|
||||
if (WIKI.config.ssl.enabled) {
|
||||
WIKI.logger.info(`HTTPS Server on port: [ ${WIKI.config.port} ]`)
|
||||
const tlsOpts = {}
|
||||
try {
|
||||
if (WIKI.config.ssl.format === 'pem') {
|
||||
tlsOpts.key = fs.readFileSync(WIKI.config.ssl.key)
|
||||
tlsOpts.cert = fs.readFileSync(WIKI.config.ssl.cert)
|
||||
} else {
|
||||
tlsOpts.pfx = fs.readFileSync(WIKI.config.ssl.pfx)
|
||||
}
|
||||
if (!_.isEmpty(WIKI.config.ssl.passphrase)) {
|
||||
tlsOpts.passphrase = WIKI.config.ssl.passphrase
|
||||
}
|
||||
if (!_.isEmpty(WIKI.config.ssl.dhparam)) {
|
||||
tlsOpts.dhparam = WIKI.config.ssl.dhparam
|
||||
}
|
||||
} catch (err) {
|
||||
WIKI.logger.error('Failed to setup HTTPS server parameters:')
|
||||
WIKI.logger.error(err)
|
||||
return process.exit(1)
|
||||
}
|
||||
WIKI.server = https.createServer(tlsOpts, app)
|
||||
} else {
|
||||
WIKI.logger.info(`HTTP Server on port: [ ${WIKI.config.port} ]`)
|
||||
WIKI.server = http.createServer(app)
|
||||
}
|
||||
WIKI.logger.info(`HTTP Server on port: [ ${WIKI.config.port} ]`)
|
||||
WIKI.server = http.createServer(app)
|
||||
WIKI.server.listen(WIKI.config.port, WIKI.config.bindIP)
|
||||
|
||||
var openConnections = []
|
||||
|
Loading…
Reference in New Issue
Block a user