Timoney, Daniel (dt5972) | 324ee36 | 2017-02-15 10:37:53 -0500 | [diff] [blame] | 1 | #!/usr/bin/env node |
| 2 | var debug = require('debug')('admportal'); |
| 3 | var app = require('../server/app'); |
Rotundo, Alfred (ar3165) | 6771045 | 2018-11-20 19:31:46 +0000 | [diff] [blame] | 4 | var constants = require('constants'); |
Timoney, Daniel (dt5972) | 324ee36 | 2017-02-15 10:37:53 -0500 | [diff] [blame] | 5 | var properties = require(process.env.SDNC_CONFIG_DIR + '/admportal.json'); |
Rotundo, Alfred (ar3165) | 6771045 | 2018-11-20 19:31:46 +0000 | [diff] [blame] | 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"; |
Timoney, Daniel (dt5972) | 324ee36 | 2017-02-15 10:37:53 -0500 | [diff] [blame] | 9 | |
Rotundo, Alfred (ar3165) | 6771045 | 2018-11-20 19:31:46 +0000 | [diff] [blame] | 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; |
Timoney, Dan (dt5972) | b685bb6 | 2019-04-12 10:00:20 -0400 | [diff] [blame] | 15 | var sslCert = properties.ConexusNetwork_sslCert; |
Timoney, Daniel (dt5972) | 324ee36 | 2017-02-15 10:37:53 -0500 | [diff] [blame] | 16 | |
Rotundo, Alfred (ar3165) | 6771045 | 2018-11-20 19:31:46 +0000 | [diff] [blame] | 17 | if (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) | b685bb6 | 2019-04-12 10:00:20 -0400 | [diff] [blame] | 27 | if (typeof https_port != 'undefined' && https_port.length > 0 && sslCert.length > 0) |
Rotundo, Alfred (ar3165) | 6771045 | 2018-11-20 19:31:46 +0000 | [diff] [blame] | 28 | { |
| 29 | var sslOptions = { |
Timoney, Dan (dt5972) | b685bb6 | 2019-04-12 10:00:20 -0400 | [diff] [blame] | 30 | pfx: fs.readFileSync(sslCert), |
Rotundo, Alfred (ar3165) | 6771045 | 2018-11-20 19:31:46 +0000 | [diff] [blame] | 31 | 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 | } |