5c639e8f668c35a593965369b8ed6ef773292c08
[sdnc/oam.git] / admportal / shell / www
1 #!/usr/bin/env node
2 var debug = require('debug')('admportal');
3 var app = require('../server/app');
4 var constants = require('constants');
5 var properties = require(process.env.SDNC_CONFIG_DIR + '/admportal.json');
6 var out_file = "/opt/onap/sdnc/admportal/logs/http_admportal.log";
7 var error_file = "/opt/onap/sdnc/admportal/logs/error_http_admportal.log";
8 var cwd = "/opt/onap/sdnc/admportal";
9
10 var fs = require('fs.extra');
11 var https = require('https');
12 var http_port = properties.nonSslPort;
13 var https_port = properties.ConexusNetworkPort;
14 var cert_pswd = process.env.CERT_PSWD;
15
16 if (typeof http_port != 'undefined' && http_port.length > 0)
17 {
18         app.set('port', http_port );
19         var server = app.listen(app.get('port'), function() 
20         {
21                 console.log('Express server listening on port ' + server.address().port);
22                 debug('Express server listening on port ' + server.address().port);
23         });
24 }
25
26 if (typeof https_port != 'undefined' && https_port.length > 0)
27 {
28         var sslOptions = {
29                 pfx: fs.readFileSync(properties.ConexusNetwork_sslCert),
30                 passphrase: properties.ConexusNetwork_sslKey,
31                 secureOptions: constants.SSL_OP_NO_TLSv1|constants.SSL_OP_NO_SSLv2|constants.SSL_OP_NO_SSLv3,
32                 ciphers: [ "AES128-GCM-SHA256","!RC4","HIGH","!MD5","!aNULL","!EDH","!3DES" ].join(':'),
33                 honorCipherOrder: true,
34                 requestCert: true,
35                 rejectUnauthorized: false
36   };
37   app.set('port', https_port);
38   var secureServer = https.createServer(sslOptions,app).listen(app.get('port'), function(){
39     console.log('Express server (https) listening on port ' + secureServer.address().port);
40     debug('Express server (https) listening on port ' + secureServer.address().port);
41   });
42 }