mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
🔀 Merge branch 'master' of https://github.com/coolpay64/n8n into coolpay64-master
This commit is contained in:
commit
37ccff8cb8
|
@ -175,6 +175,18 @@ const config = convict({
|
||||||
env: 'N8N_PROTOCOL',
|
env: 'N8N_PROTOCOL',
|
||||||
doc: 'HTTP Protocol via which n8n can be reached'
|
doc: 'HTTP Protocol via which n8n can be reached'
|
||||||
},
|
},
|
||||||
|
ssl_key: {
|
||||||
|
format: String,
|
||||||
|
default: 'server.key',
|
||||||
|
env: 'N8N_SSL_KEY',
|
||||||
|
doc: 'SSL Key for HTTPS Protocol'
|
||||||
|
},
|
||||||
|
ssl_cert: {
|
||||||
|
format: String,
|
||||||
|
default: 'server.pem',
|
||||||
|
env: 'N8N_SSL_CERT',
|
||||||
|
doc: 'SSL Cert for HTTPS Protocol'
|
||||||
|
},
|
||||||
|
|
||||||
security: {
|
security: {
|
||||||
basicAuth: {
|
basicAuth: {
|
||||||
|
|
|
@ -97,6 +97,10 @@ class App {
|
||||||
push: Push.Push;
|
push: Push.Push;
|
||||||
versions: IPackageVersions | undefined;
|
versions: IPackageVersions | undefined;
|
||||||
|
|
||||||
|
protocol: string;
|
||||||
|
ssl_key: string;
|
||||||
|
ssl_cert: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.app = express();
|
this.app = express();
|
||||||
|
|
||||||
|
@ -112,6 +116,10 @@ class App {
|
||||||
this.push = Push.getInstance();
|
this.push = Push.getInstance();
|
||||||
|
|
||||||
this.activeExecutionsInstance = ActiveExecutions.getInstance();
|
this.activeExecutionsInstance = ActiveExecutions.getInstance();
|
||||||
|
|
||||||
|
this.protocol = config.get('protocol');
|
||||||
|
this.ssl_key = config.get('ssl_key');
|
||||||
|
this.ssl_cert = config.get('ssl_cert');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1255,7 +1263,22 @@ export async function start(): Promise<void> {
|
||||||
|
|
||||||
await app.config();
|
await app.config();
|
||||||
|
|
||||||
app.app.listen(PORT, async () => {
|
// Differntiate HTTP and HTTPS server
|
||||||
|
const http = require('http');
|
||||||
|
const https = require('https');
|
||||||
|
const fs = require('fs');
|
||||||
|
var server;
|
||||||
|
|
||||||
|
if(app.protocol === 'https'){
|
||||||
|
const privateKey = fs.readFileSync(app.ssl_key,'utf8');
|
||||||
|
const cert = fs.readFileSync(app.ssl_cert,'utf8');
|
||||||
|
const credentials = {key: privateKey,cert: cert};
|
||||||
|
server = https.createServer(credentials,app.app);
|
||||||
|
}else{
|
||||||
|
server = http.createServer(app.app);
|
||||||
|
}
|
||||||
|
|
||||||
|
server.listen(PORT, async () => {
|
||||||
const versions = await GenericHelpers.getVersions();
|
const versions = await GenericHelpers.getVersions();
|
||||||
console.log(`n8n ready on port ${PORT}`);
|
console.log(`n8n ready on port ${PORT}`);
|
||||||
console.log(`Version: ${versions.cli}`);
|
console.log(`Version: ${versions.cli}`);
|
||||||
|
|
Loading…
Reference in a new issue