Download Game! Currently 88 players and visitors. Last logged in:CilwandDesertSqwarkTigerlily

Blitzer's Blog >> 72062

Back to blogs index
Posted: 05 Sep 2026 14:21 [ permalink ]
Thank you. 

Error: listen EADDRINUSE: address already in use :::8080

Could we make it look up if ../dmz_relay_cfg.json or ./dmz_relay_cfg.json
exist, parse it as a JSON object, and look up "listen_address" and
"listen_port" ?

It can default to 8080, and it could also try to look up DMZ_RELAY_LISTEN_ADDRE
SS and DMZ_RELAY_LISTEN_PORT from environment variables

And to be helpful, it could print upon startup all of the above are available
for configuration needs

==

That EADDRINUSE error means another service on your machine is already bound
to port 8080 (very common with local development).

To solve this and make the node highly configurable across different
environments, we will implement a standard Configuration Hierarchy (Defaults 
JSON File  Environment Variables).

Here is the updated dmz_relay.js. I've added a robust loadConfig() function
that checks both paths, parses the JSON safely, layers on any environment
variables, and prints a helpful configuration guide to the console on boot.

==

To fix your current EADDRINUSE issue:
You now have three ways to change the port:

Method 1: Creating a JSON config (Recommended)
Create dmz_relay_cfg.json in the same directory as the script (or one
directory up) with this payload:

JSON
{
  "listen_address": "127.0.0.1",
  "listen_port": 8081
}
Method 2: Inline Environment Variables (Unix/Mac)

Bash
DMZ_RELAY_LISTEN_PORT=8081 node dmz_relay.js
Method 3: Inline Environment Variables (Windows PowerShell)

PowerShell
$env:DMZ_RELAY_LISTEN_PORT="8081"; node dmz_relay.js