blob: ef5dcae51881efd051de88737c5a6d66c8bc2c32 [file] [log] [blame]
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05001#!/usr/bin/env node
2var debug = require('debug')('admportal');
3var app = require('../server/app');
Rotundo, Alfred (ar3165)67710452018-11-20 19:31:46 +00004var constants = require('constants');
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05005var properties = require(process.env.SDNC_CONFIG_DIR + '/admportal.json');
Rotundo, Alfred (ar3165)67710452018-11-20 19:31:46 +00006var out_file = "/opt/onap/sdnc/admportal/logs/http_admportal.log";
7var error_file = "/opt/onap/sdnc/admportal/logs/error_http_admportal.log";
8var cwd = "/opt/onap/sdnc/admportal";
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05009
Rotundo, Alfred (ar3165)67710452018-11-20 19:31:46 +000010var fs = require('fs.extra');
11var https = require('https');
12var http_port = properties.nonSslPort;
13var https_port = properties.ConexusNetworkPort;
14var cert_pswd = process.env.CERT_PSWD;
Timoney, Dan (dt5972)b685bb62019-04-12 10:00:20 -040015var sslCert = properties.ConexusNetwork_sslCert;
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -050016
Rotundo, Alfred (ar3165)67710452018-11-20 19:31:46 +000017if (typeof http_port != 'undefined' && http_port.length > 0)
18{
19 app.set('port', http_port );
20 var server = app.listen(app.get('port'), function()
21 {
22 console.log('Express server listening on port ' + server.address().port);
23 debug('Express server listening on port ' + server.address().port);
24 });
25}
26
Timoney, Dan (dt5972)b685bb62019-04-12 10:00:20 -040027if (typeof https_port != 'undefined' && https_port.length > 0 && sslCert.length > 0)
Rotundo, Alfred (ar3165)67710452018-11-20 19:31:46 +000028{
29 var sslOptions = {
Timoney, Dan (dt5972)b685bb62019-04-12 10:00:20 -040030 pfx: fs.readFileSync(sslCert),
Rotundo, Alfred (ar3165)67710452018-11-20 19:31:46 +000031 passphrase: properties.ConexusNetwork_sslKey,
32 secureOptions: constants.SSL_OP_NO_TLSv1|constants.SSL_OP_NO_SSLv2|constants.SSL_OP_NO_SSLv3,
33 ciphers: [ "AES128-GCM-SHA256","!RC4","HIGH","!MD5","!aNULL","!EDH","!3DES" ].join(':'),
34 honorCipherOrder: true,
35 requestCert: true,
36 rejectUnauthorized: false
37 };
38 app.set('port', https_port);
39 var secureServer = https.createServer(sslOptions,app).listen(app.get('port'), function(){
40 console.log('Express server (https) listening on port ' + secureServer.address().port);
41 debug('Express server (https) listening on port ' + secureServer.address().port);
42 });
43}