add https support 2
This commit is contained in:
parent
e3de0efdd2
commit
506a267ed0
@ -91,6 +91,7 @@ INSIGHT_IGNORE_CACHE # True to ignore cache of spents in transaction, with more
|
||||
ENABLE_MAILBOX # if "true" will enable mailbox plugin
|
||||
ENABLE_RATELIMITER # if "true" will enable the ratelimiter plugin
|
||||
LOGGER_LEVEL # defaults to 'info', can be 'debug','verbose','error', etc.
|
||||
ENABLE_HTTPS # if "true" it will server using SSL/HTTPS
|
||||
|
||||
```
|
||||
|
||||
|
||||
@ -64,14 +64,15 @@ var expressApp = express();
|
||||
|
||||
|
||||
// setup http/https base server
|
||||
var protocol = config.enableHTTPS ? https : http;
|
||||
var serverOpts = {};
|
||||
var server;
|
||||
if (config.enableHTTPS) {
|
||||
var serverOpts = {};
|
||||
serverOpts.key = fs.readFileSync('./etc/test-key.pem');
|
||||
serverOpts.cert = fs.readFileSync('./etc/test-cert.pem');
|
||||
server = https.createServer(serverOpts, expressApp);
|
||||
} else {
|
||||
server = http.createServer(expressApp);
|
||||
}
|
||||
var server = protocol.createServer(serverOpts, expressApp);
|
||||
console.log(config.enableHTTPS);
|
||||
|
||||
// Bootstrap models
|
||||
var models_path = __dirname + '/app/models';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user