Make sure that it looks for SSL certs only if defined

This commit is contained in:
Jan Oberhauser
2020-03-30 13:29:42 +02:00
parent 60826ba19d
commit 7c5f437e92
2 changed files with 5 additions and 5 deletions

View File

@@ -1268,10 +1268,10 @@ export async function start(): Promise<void> {
let server;
if(app.protocol === 'https'){
if (app.protocol === 'https' && app.sslKey && app.sslCert){
const https = require('https');
const privateKey = readFileSync(app.sslKey,'utf8');
const cert = readFileSync(app.sslCert,'utf8');
const privateKey = readFileSync(app.sslKey, 'utf8');
const cert = readFileSync(app.sslCert, 'utf8');
const credentials = { key: privateKey,cert };
server = https.createServer(credentials,app.app);
}else{