Made http redirect configurable in dashboard.ini

main
John Hays 9 months ago
parent cccf2be043
commit aae8d44b94

@ -12,6 +12,8 @@ const inifile = ini.parse(fs.readFileSync('/usr/local/etc/dashboard.ini', 'utf-8
const host = inifile.config.host; const host = inifile.config.host;
const port = inifile.config.port; const port = inifile.config.port;
const links = inifile.logs.links; const links = inifile.logs.links;
const redirecthttp = inifile.config.redirecthttp;
const httpport = inifile.config.httpport;
const linkqueue = parseInt(inifile.params.linkqueue); const linkqueue = parseInt(inifile.params.linkqueue);
const heardqueue = parseInt(inifile.params.heardqueue); const heardqueue = parseInt(inifile.params.heardqueue);
const headers = inifile.logs.headers; const headers = inifile.logs.headers;
@ -135,7 +137,8 @@ const tailheaders = new Tail(headers, {startPos : 'end'}, line => {
}); });
tailheaders.start(); 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"); var http = require("http");
http http
@ -143,4 +146,5 @@ http
res.writeHead(301, { Location: "https:"+host }); res.writeHead(301, { Location: "https:"+host });
res.end(); res.end();
}) })
.listen(80); .listen(httpport);
}

@ -5,6 +5,8 @@ links=/var/log/dstargateway/Links.log
dgwconfig=/usr/local/etc/dstargateway.cfg dgwconfig=/usr/local/etc/dstargateway.cfg
host= #enter your domain name here (this should also have a cert for https) host= #enter your domain name here (this should also have a cert for https)
port=443 port=443
redirecthttp=true #switch to false if using http
httpport=80
[urls] [urls]
sponsorname= #sponsor name sponsorname= #sponsor name
cosponsorname= #cosponsor name cosponsorname= #cosponsor name

Loading…
Cancel
Save