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!

fix: accept IPv6 connections by default

Ekko82d833b4074a27
diff --git a/Dockerfile b/Dockerfile
index 5075edf9..a282c6b8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -36,8 +36,7 @@ LABEL org.opencontainers.image.title="Dashy" \
ENV NODE_ENV=production \
IS_DOCKER=true \
- PORT=8080 \
- HOST=0.0.0.0
+ PORT=8080
WORKDIR /app
diff --git a/docs/developing.md b/docs/developing.md
index ddab59d7..fd5239fe 100644
--- a/docs/developing.md
+++ b/docs/developing.md
@@ -72,7 +72,7 @@ You can set variables either in your environment, or using the [`.env`](https://
- `NODE_ENV` - Current environment, can be either development, production or test
- `PORT` - The port to expose the running application on
-- `HOST` - The host that Dashy is running on, domain or IP
+- `HOST` - The address on which the HTTP and HTTPS servers listen. When unset, Node uses `::` if IPv6 is available, or `0.0.0.0` otherwise. On most systems `::` also accepts IPv4 connections. Set `HOST=0.0.0.0` to listen on IPv4 only, or a specific address to restrict the binding.
- `VITE_APP_DOMAIN` - The address of Dashy's server, if it's not the same as where the frontend is served from
- `INTEGRITY` - Should enable SRI for build script and link resources
- `IS_DOCKER` - Computed automatically on build. Indicates if running in container
diff --git a/server.js b/server.js
index 24bf380d..c2dde8ce 100644
--- a/server.js
+++ b/server.js
@@ -19,8 +19,8 @@ const isDocker = !!process.env.IS_DOCKER;
/* 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';
+/* Let Node choose the unspecified address unless HOST is explicitly set. */
+const host = process.env.HOST || undefined;
/* Gets the users local IP and port, then calls to print welcome message */
const printWelcomeMessage = () => {
diff --git a/services/utils/ssl-server.js b/services/utils/ssl-server.js
index c25dc4dd..cbdbfc7c 100644
--- a/services/utils/ssl-server.js
+++ b/services/utils/ssl-server.js
@@ -5,7 +5,7 @@ const https = require('https');
const promise = util.promisify;
const stat = promise(fs.stat);
-const host = process.env.HOST || '0.0.0.0';
+const host = process.env.HOST || undefined;
const httpsCerts = {
private: process.env.SSL_PRIV_KEY_PATH || '/etc/ssl/certs/dashy-priv.key',