mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
⚡ Make sure that it looks for SSL certs only if defined
This commit is contained in:
parent
60826ba19d
commit
7c5f437e92
|
@ -177,13 +177,13 @@ const config = convict({
|
||||||
},
|
},
|
||||||
ssl_key: {
|
ssl_key: {
|
||||||
format: String,
|
format: String,
|
||||||
default: 'server.key',
|
default: '',
|
||||||
env: 'N8N_SSL_KEY',
|
env: 'N8N_SSL_KEY',
|
||||||
doc: 'SSL Key for HTTPS Protocol'
|
doc: 'SSL Key for HTTPS Protocol'
|
||||||
},
|
},
|
||||||
ssl_cert: {
|
ssl_cert: {
|
||||||
format: String,
|
format: String,
|
||||||
default: 'server.pem',
|
default: '',
|
||||||
env: 'N8N_SSL_CERT',
|
env: 'N8N_SSL_CERT',
|
||||||
doc: 'SSL Cert for HTTPS Protocol'
|
doc: 'SSL Cert for HTTPS Protocol'
|
||||||
},
|
},
|
||||||
|
|
|
@ -1268,10 +1268,10 @@ export async function start(): Promise<void> {
|
||||||
|
|
||||||
let server;
|
let server;
|
||||||
|
|
||||||
if(app.protocol === 'https'){
|
if (app.protocol === 'https' && app.sslKey && app.sslCert){
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const privateKey = readFileSync(app.sslKey,'utf8');
|
const privateKey = readFileSync(app.sslKey, 'utf8');
|
||||||
const cert = readFileSync(app.sslCert,'utf8');
|
const cert = readFileSync(app.sslCert, 'utf8');
|
||||||
const credentials = { key: privateKey,cert };
|
const credentials = { key: privateKey,cert };
|
||||||
server = https.createServer(credentials,app.app);
|
server = https.createServer(credentials,app.app);
|
||||||
}else{
|
}else{
|
||||||
|
|
Loading…
Reference in a new issue