Added support for both https AND http, config is now untracked by git

This commit is contained in:
Daniel Vestøl committed 2018-06-08 09:33:19 +02:00
1 parent a9532dd0d3
commit 94bbf62c26
3 files changed
+37 -21

No files matched your search

+7 -6
View File
@@ -911,15 +911,16 @@ app.get("/api/getFactorioLocale", function(req,res){
httpRequestDurationMilliseconds.labels(req.route.path).observe(Date.now()-reqStartTime);
});
});
if(config.masterPort == 443){
var privateKey = fs.readFileSync( 'privatekey.pem' );
var certificate = fs.readFileSync( 'certificate.pem' );
if(config.sslPort){
var certificate = fs.readFileSync( 'database/certificates/cert.crt' );
var privateKey = fs.readFileSync( 'database/certificates/cert.key' );
server = https.createServer({
httpsServer = https.createServer({
key: privateKey,
cert: certificate
}, app).listen(443);
} else {
}, app).listen(config.sslPort);
}
if(config.masterPort){
server = require("http").Server(app);
server.listen(config.masterPort || 8080, function () {
console.log("Listening on port %s...", server.address().port);