Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

⚑ Lint and port update

Alicia Sykes4d851b6e86e4
diff --git a/server.js b/server.js
index e3a9f5d5..76c48f9d 100644
--- a/server.js
+++ b/server.js
@@ -38,8 +38,8 @@ const ENDPOINTS = require('./src/utils/defaults').serviceEndpoints; // API endpo
/* Checks if app is running within a container, from env var */
const isDocker = !!process.env.IS_DOCKER;
-/* Checks env var for port. If undefined, will use Port 80 for Docker, or 4000 for metal */
-const port = process.env.PORT || (isDocker ? 80 : 4000);
+/* Checks env var for port. If undefined, will use Port 8080 for Docker, or 4000 for metal */
+const port = process.env.PORT || (isDocker ? 8080 : 4000);
/* Checks env var for host. If undefined, will use 0.0.0.0 */
const host = process.env.HOST || '0.0.0.0';
diff --git a/services/healthcheck.js b/services/healthcheck.js
index d0ba2421..f6eca0cc 100644
--- a/services/healthcheck.js
+++ b/services/healthcheck.js
@@ -6,11 +6,17 @@
const isSsl = !!process.env.SSL_PRIV_KEY_PATH && !!process.env.SSL_PUB_KEY_PATH;
+// eslint-disable-next-line import/no-dynamic-require
const http = require(isSsl ? 'https' : 'http');
/* Location of the server to test */
const isDocker = !!process.env.IS_DOCKER;
-const port = isSsl ? (process.env.SSL_PORT || (isDocker ? 443 : 4001)) : (process.env.PORT || (isDocker ? 80 : 4000));
+
+/* Get the port to use (depending on, if docker, if SSL) */
+const sslPort = process.env.SSL_PORT || (isDocker ? 443 : 4001);
+const normalPort = process.env.PORT || (isDocker ? 80 : 4000);
+const port = isSsl ? sslPort : normalPort;
+
const host = process.env.HOST || '0.0.0.0';
const timeout = 2000;
@@ -18,7 +24,9 @@ const agent = new http.Agent({
rejectUnauthorized: false, // Allow self-signed certificates
});
-const requestOptions = { host, port, timeout, agent };
+const requestOptions = {
+ host, port, timeout, agent,
+};
const startTime = new Date(); // Initialize timestamp to calculate time taken