#!/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;
var sslCert = properties.ConexusNetwork_sslCert;

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 && sslCert.length > 0)
{
	var sslOptions = {
		pfx: fs.readFileSync(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);
  });
}
