Mercurial > hg > rlgwebd
changeset 204:a200b313870d
Use either HTTP or HTTPS.
If HTTPS is enabled, RLGWebD will not use insecure HTTP.
author | John "Elwin" Edwards |
---|---|
date | Sun, 08 Jan 2017 16:17:11 -0500 |
parents | 5491ca3a335b |
children | 6651f54a0062 |
files | rlgwebd rlgwebd.conf |
diffstat | 2 files changed, 15 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/rlgwebd Wed Jan 04 21:25:43 2017 -0500 +++ b/rlgwebd Sun Jan 08 16:17:11 2017 -0500 @@ -16,8 +16,7 @@ /* Default options */ var rlgwebd_options = { control_socket: "/var/run/rlgwebd.sock", - http_port: 8080, - https_port: 8081, + port: 8080, chrootDir: "/var/dgl/", username: "rodney", static_root: "/var/www/" @@ -1288,20 +1287,22 @@ tslog("Could not drop permissions: %s", err); process.exit(1); } - httpServer = http.createServer(webHandler); - httpServer.listen(rlgwebd_options.http_port); - tslog('rlgwebd running on port %d', rlgwebd_options.http_port); - wsServer = new WebSocketServer({"httpServer": httpServer}); - wsServer.on("request", wsHandler); - tslog('WebSockets are online'); if (rlgwebd_options.use_https) { - var httpsServer = https.createServer(tls_options, webHandler); - httpsServer.listen(rlgwebd_options.https_port); - tslog('TLS running on port %d', rlgwebd_options.https_port); - var wssServer = new WebSocketServer({"httpServer": httpsServer}); - wssServer.on("request", wsHandler); + httpServer = https.createServer(tls_options, webHandler); + httpServer.listen(rlgwebd_options.port); + tslog('rlgwebd running on port %d (TLS)', rlgwebd_options.port); + wsServer = new WebSocketServer({"httpServer": httpServer}); + wsServer.on("request", wsHandler); tslog('Secure WebSockets are online'); } + else { + httpServer = http.createServer(webHandler); + httpServer.listen(rlgwebd_options.port); + tslog('rlgwebd running on port %d', rlgwebd_options.port); + wsServer = new WebSocketServer({"httpServer": httpServer}); + wsServer.on("request", wsHandler); + tslog('WebSockets are online'); + } progressWatcher = startProgressWatcher(); setInterval(pushStatus, 40000); });
--- a/rlgwebd.conf Wed Jan 04 21:25:43 2017 -0500 +++ b/rlgwebd.conf Sun Jan 08 16:17:11 2017 -0500 @@ -5,9 +5,7 @@ # Location of the socket for start/stop commands #control_socket = /var/run/rlgwebd.sock # Port number to bind -#http_port = 8080 -# Port number for HTTPS -#https_port = 8081 +#port = 8080 # Path to the dgamelaunch installation to chroot into # If you change this, change the Makefile too #chrootDir = /var/dgl/