diff options
author | Chinthakayala, Sheshashailavas (sc2914) <sc2914@att.com> | 2019-08-02 16:22:16 +0000 |
---|---|---|
committer | Chinthakayala, Sheshashailavas (sc2914) <sc2914@att.com> | 2019-08-02 16:23:47 +0000 |
commit | 347321e1530e50084d54b2428fc3b6310853c957 (patch) | |
tree | e763c6c7cad2eb08240e8a89148cbf2140fbf30d /dgbuilder/red.js | |
parent | a56617de3c395d12fb013de468d14f3a0d769c2a (diff) |
[CCSDK-1579] updated to use https
added a property to customSettings.js to enable https
Change-Id: I6c6adcc6b6e07a3bfaf7ae1e3c304a7a6216ae8f
Signed-off-by: Chinthakayala, Sheshashailavas (sc2914) <sc2914@att.com>
Diffstat (limited to 'dgbuilder/red.js')
-rw-r--r-- | dgbuilder/red.js | 12 |
1 files changed, 8 insertions, 4 deletions
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) { |