summaryrefslogtreecommitdiffstats
path: root/admportal/shell/www
blob: 5c639e8f668c35a593965369b8ed6ef773292c08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
var debug = require('debug')('admportal');
var app = require('../server/app');
var constants = require('constants');
var properties = require(process.env.SDNC_CONFIG_DIR + '/admportal.json');
var out_file = "/opt/onap/sdnc/admportal/logs/http_admportal.log";
var error_file = "/opt/onap/sdnc/admportal/logs/error_http_admportal.log";
var cwd = "/opt/onap/sdnc/admportal";

var fs = require('fs.extra');
var https = require('https');
var http_port = properties.nonSslPort;
var https_port = properties.ConexusNetworkPort;
var cert_pswd = process.env.CERT_PSWD;

if (typeof http_port != 'undefined' && http_port.length > 0)
{
	app.set('port', http_port );
	var server = app.listen(app.get('port'), function() 
	{
		console.log('Express server listening on port ' + server.address().port);
		debug('Express server listening on port ' + server.address().port);
	});
}

if (typeof https_port != 'undefined' && https_port.length > 0)
{
	var sslOptions = {
		pfx: fs.readFileSync(properties.ConexusNetwork_sslCert),
		passphrase: properties.ConexusNetwork_sslKey,
		secureOptions: constants.SSL_OP_NO_TLSv1|constants.SSL_OP_NO_SSLv2|constants.SSL_OP_NO_SSLv3,
		ciphers: [ "AES128-GCM-SHA256","!RC4","HIGH","!MD5","!aNULL","!EDH","!3DES" ].join(':'),
		honorCipherOrder: true,
		requestCert: true,
		rejectUnauthorized: false
  };
  app.set('port', https_port);
  var secureServer = https.createServer(sslOptions,app).listen(app.get('port'), function(){
    console.log('Express server (https) listening on port ' + secureServer.address().port);
    debug('Express server (https) listening on port ' + secureServer.address().port);
  });
}