diff --git a/index.js b/index.js index b9e3438..0cc1626 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,8 @@ const inifile = ini.parse(fs.readFileSync('/usr/local/etc/dashboard.ini', 'utf-8 const host = inifile.config.host; const port = inifile.config.port; const links = inifile.logs.links; +const redirecthttp = inifile.config.redirecthttp; +const httpport = inifile.config.httpport; const linkqueue = parseInt(inifile.params.linkqueue); const heardqueue = parseInt(inifile.params.heardqueue); const headers = inifile.logs.headers; @@ -135,7 +137,8 @@ const tailheaders = new Tail(headers, {startPos : 'end'}, line => { }); tailheaders.start(); -// Comment out the following lines if you don't want to redirect http to https +// See dashboard.ini in /usr/local/etc +if (redirecthttp){ var http = require("http"); http @@ -143,4 +146,5 @@ http res.writeHead(301, { Location: "https:"+host }); res.end(); }) - .listen(80); + .listen(httpport); +} diff --git a/util/dashboard.ini b/util/dashboard.ini index c198364..a24597b 100644 --- a/util/dashboard.ini +++ b/util/dashboard.ini @@ -5,6 +5,8 @@ links=/var/log/dstargateway/Links.log dgwconfig=/usr/local/etc/dstargateway.cfg host= #enter your domain name here (this should also have a cert for https) port=443 +redirecthttp=true #switch to false if using http +httpport=80 [urls] sponsorname= #sponsor name cosponsorname= #cosponsor name