From 6ba37aefd61ab82a42b58e5ae6d4d88077394769 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Wed, 8 Nov 2023 09:59:21 +0100 Subject: [PATCH] Added port selection to config --- client/bin/www | 12 +++++++++++- olympus.json | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client/bin/www b/client/bin/www index 887394f4..bb2e7ac7 100644 --- a/client/bin/www +++ b/client/bin/www @@ -1,5 +1,9 @@ #!/usr/bin/env node +var fs = require('fs'); +let rawdata = fs.readFileSync('../olympus.json'); +let config = JSON.parse(rawdata); + /** * Module dependencies. */ @@ -12,8 +16,14 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '3000'); +var configPort = null; +if (config["client"] != undefined && config["client"]["port"] != undefined) { + configPort = config["client"]["port"]; +} + +var port = normalizePort(configPort || '3000'); app.set('port', port); +console.log("Express server listening on port: " + port) /** * Create HTTP server. diff --git a/olympus.json b/olympus.json index a0cd5c0f..209d3da7 100644 --- a/olympus.json +++ b/olympus.json @@ -9,6 +9,7 @@ "redCommanderPassword": "redpassword" }, "client": { + "port": 3000, "elevationProvider": { "provider": "https://srtm.fasma.org/{lat}{lng}.SRTMGL3S.hgt.zip", "username": null,