From 347321e1530e50084d54b2428fc3b6310853c957 Mon Sep 17 00:00:00 2001 From: "Chinthakayala, Sheshashailavas (sc2914)" Date: Fri, 2 Aug 2019 16:22:16 +0000 Subject: [CCSDK-1579] updated to use https added a property to customSettings.js to enable https Change-Id: I6c6adcc6b6e07a3bfaf7ae1e3c304a7a6216ae8f Signed-off-by: Chinthakayala, Sheshashailavas (sc2914) --- dgbuilder/red.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'dgbuilder/red.js') diff --git a/dgbuilder/red.js b/dgbuilder/red.js index 14f6d38c..460b2efd 100644 --- a/dgbuilder/red.js +++ b/dgbuilder/red.js @@ -21,7 +21,7 @@ var crypto = require("crypto"); var nopt = require("nopt"); var path = require("path"); var RED = require("./red/red.js"); - +var fs = require('fs') var server; var app = express(); @@ -77,8 +77,12 @@ if (parsedArgs.v) { settings.verbose = true; } -if (settings.https) { - server = https.createServer(settings.https,function(req,res){app(req,res);}); +if (settings.enableHttps) { + //server = https.createServer(settings.https,function(req,res){app(req,res);}); + server = https.createServer({ + key: fs.readFileSync('certs/node-key.pem'), + cert: fs.readFileSync('certs/node-cert.pem'), + requireHttps : true},function(req,res){app(req,res);}); } else { server = http.createServer(function(req,res){app(req,res);}); } @@ -159,7 +163,7 @@ if (settings.httpStatic) { } function getListenPath() { - var listenPath = 'http'+(settings.https?'s':'')+'://'+ + var listenPath = 'http'+(settings.enableHttps?'s':'')+'://'+ (settings.uiHost == '0.0.0.0'?'127.0.0.1':settings.uiHost)+ ':'+settings.uiPort; if (settings.httpAdminRoot !== false) { -- cgit 1.2.3-korg