@@ -127,40 +127,154 @@ Basic service-to-host mappings:
127127` ` ` json
128128{
129129 " hosts" : {
130- " server-1 " : {
130+ " server" : {
131131 " ip" : "192.168.1.1",
132132 " mac" : "XX:XX:XX:XX:XX:XX",
133133 " startupTime" : 60
134134 }
135135 },
136136 " routes" : {
137- " server-1 " : {
138- " route" : ["server-1 "]
137+ " server-only " : {
138+ " route" : ["server"]
139139 }
140140 },
141141 " records" : {
142- " *.mydomain.com" : "server-1 "
142+ " *.mydomain.com" : "server-only "
143143 }
144144}
145145```
146146
147147Environment variables:
148148
149149``` dotenv
150- CLIENT_ID=CLIENT_ID
151- CLIENT_SECRET=CLIENT_SECRET
152-
153- # Authentik setup
154- AUTH_URL=https://authentication.mydomain.com/application/o/authorize/
155- TOKEN_URL=https://authentication.mydomain.com/application/o/token/
156- REDIRECT_URL=https://wol-redirect.mydomain.com/auth/callback/
157- RESOURCE_URL=https://authentication.mydomain.com/application/o/userinfo/
158- LOGOUT_URL=https://authentication.mydomain.com/application/o/wol-red/end-session/
159-
160- SESSION_KEY=MY_SESSION_KEY # generate this with openssl
161- SCOPE=openid
150+ ############################
151+ # Core Application Settings
152+ ############################
153+
154+ # Path to the service mapping configuration file
155+ CONFIG_PATH=/app/config/mapping.json
156+
157+ # Port WoL Redirect listens on
158+ PORT=6789
159+
160+ # Log level: trace | debug | info | warn | error | fatal
161+ LOG_LEVEL=info
162+
163+ # Expose logs via the UI or HTTP endpoint
164+ EXPOSE_LOGS=true
165+
166+
167+ ############################
168+ # Session & Security
169+ ############################
170+
171+ # Secret key used to sign sessions (REQUIRED)
172+ # Generate a long random string
173+ SESSION_KEY=change-me-to-a-random-secret
174+
175+
176+ ############################
177+ # Redis Configuration
178+ ############################
179+
180+ # Redis hostname or service name
181+ REDIS_HOST=redis
182+
183+ # Redis port
184+ REDIS_PORT=6379
185+
186+ # Redis username (usually "default")
187+ REDIS_USER=default
188+
189+ # Redis password (use long secure password)
190+ REDIS_PASSWORD=
191+
192+
193+ ############################
194+ # Wake-on-LAN / Helper Services
195+ ############################
196+
197+ # Default query pattern used to match WoL services
198+ WOLD_QUERY_PATTERN=
199+
200+ # Base URL of default your WoL Client helper
201+ # Example: http://wol-client:5555/wake
202+ WOL_URL=
203+
204+ # Default port used by WoL Dockerized helper
205+ WOLD_PORT=7777
206+
207+ # Default port used by virtualization helper (VMs / LXCs / hypervisors)
208+ VIRTUAL_PORT=9999
209+
210+
211+ ############################
212+ # OAuth Configuration
213+ ############################
214+
215+ # Enable or disable OAuth authentication
216+ USE_OAUTH=true
217+
218+ # OAuth authorization endpoint
219+ AUTHORIZATION_URL=
220+
221+ # OAuth resource / userinfo endpoint
222+ RESOURCE_URL=
223+
224+ # OAuth logout endpoint
225+ LOGOUT_URL=
226+
227+ # OAuth token endpoint
228+ TOKEN_URL=
229+
230+ # Redirect URL registered with your OAuth provider
231+ # Example: https://wol-red.mydomain.com/auth/callback
232+ REDIRECT_URL=
233+
234+ # OAuth client credentials
235+ CLIENT_ID=
236+ CLIENT_SECRET=
237+
238+ # OAuth scopes
239+ SCOPE=openid profile
162240```
163241
242+ ## Hosts Configuration
243+
244+ The ` hosts ` section defines all machines, VMs, containers, or Docker services that WoL Redirect can wake up. Each host entry may have several optional or required fields depending on its type.
245+
246+ | Field | Type | Required | Description |
247+ | -------------- | ------- | ------------------------ | ------------------------------------------------------------------------------- |
248+ | ` ip ` | string | Yes | The IP address of the host. Required for all types. |
249+ | ` mac ` | string | Required for PHYSICAL | MAC address for Wake-on-LAN. Only needed for physical hosts. |
250+ | ` id ` | string | Required for VIRTUAL | Identifier for virtual machines or LXCs. |
251+ | ` virtIP ` | string | Optional | IP of the VM/LXC for the wake API. Defaults to ` ip ` . |
252+ | ` startupTime ` | number | Optional | Seconds to wait after starting before forwarding traffic. |
253+ | ` url ` | string | Optional | Override the default helper URL for this host. |
254+ | ` docker ` | object | Required for DOCKER type | Docker-specific settings. See below. |
255+ | ` docker: true ` | boolean | Optional | Can be set to ` true ` to mark a host as DOCKER type without additional settings. |
256+
257+ ## Docker Sub-Object
258+
259+ | Field | Type | Required | Description |
260+ | -------------- | ------ | -------- | ------------------------------------------------------------------------------------------ |
261+ | ` queryPattern ` | string | Optional | Template used to build the query for WoL Dockerized. Falls back to ` ENV.woldQueryPattern ` . |
262+ | ` url ` | string | Optional | Override URL for Docker wake API. Defaults to ` http://${host.ip}:${ENV.woldPort}/wake ` . |
263+
264+ ## Host Type Inference
265+
266+ - ** PHYSICAL** → has ` mac ` and ` ip `
267+ - ** VIRTUAL** → has ` id `
268+ - ** DOCKER** → has ` docker ` object or ` docker: true `
269+
270+ ## Notes on Optional Overrides
271+
272+ - ` url ` can override default helper URLs for PHYSICAL, VIRTUAL, or DOCKER hosts.
273+ - ` virtIP ` can override the IP used by virtual helper services.
274+ - ` docker.queryPattern ` can override the global ` ENV.woldQueryPattern ` .
275+ - ` startupTime ` allows per-host delay before forwarding traffic.
276+ - The execution order of hosts in a route determines the startup sequence.
277+
164278## Advanced Setups
165279
166280WoL Redirect supports two main scenarios depending on how your services are hosted.
@@ -183,24 +297,20 @@ Example mapping configuration:
183297 "mac" : " XX:XX:XX:XX:XX:XX" ,
184298 "startupTime" : 40
185299 },
186- "lxc" : {
187- "ip" : " 192.168.1.1" ,
188- "id" : " 100" ,
189- "startupTime" : 10
190- },
191300 "vm" : {
192301 "ip" : " 192.168.1.1" ,
193302 "id" : " 200" ,
194- "startupTime" : 10
303+ "virtIP" : " 192.168.1.20" ,
304+ "startupTime" : 15
195305 }
196306 },
197307 "routes" : {
198- "hypervisor-lxc " : {
199- "route" : [" hypervisor" , " lxc " ]
308+ "hypervisor-vm " : {
309+ "route" : [" hypervisor" , " vm " ]
200310 }
201311 },
202312 "records" : {
203- "*.mydomain.com" : " hypervisor-lxc "
313+ "*.mydomain.com" : " hypervisor-vm "
204314 }
205315}
206316```
@@ -226,18 +336,20 @@ Example mapping configuration:
226336{
227337 "hosts" : {
228338 "docker-server" : {
229- "ip" : " 192.168.5.10" ,
230- "docker" : true
339+ "ip" : " 192.168.1.10" ,
340+ "docker" : {
341+ "queryPattern" : " {{HOSTNAME}}"
342+ }
231343 }
232344 },
233345 "routes" : {
234- "docker" : {
346+ "docker-only " : {
235347 "route" : [" docker-server" ]
236348 }
237349 },
238350 "records" : {
239- "jellyfin.mydomain.com" : " docker" ,
240- "*.mydomain.com" : " docker"
351+ "jellyfin.mydomain.com" : " docker-only " ,
352+ "*.mydomain.com" : " docker-only "
241353 }
242354}
243355```
@@ -249,7 +361,35 @@ If your environment uses both virtualization and Docker (for example Docker runn
249361Example mapping configuration:
250362
251363``` json
252- file not found: /home/runner/work/wol-redirect/wol-redirect/examples/config/virtual-docker.mapping.json
364+ {
365+ "hosts" : {
366+ "hypervisor" : {
367+ "ip" : " 192.168.1.1" ,
368+ "mac" : " XX:XX:XX:XX:XX:XX" ,
369+ "startupTime" : 40
370+ },
371+ "lxc" : {
372+ "ip" : " 192.168.1.1" ,
373+ "id" : " 100" ,
374+ "virtIP" : " 10.0.0.10" ,
375+ "startupTime" : 10
376+ },
377+ "docker-server" : {
378+ "ip" : " 10.0.0.10" ,
379+ "docker" : {
380+ "queryPattern" : " {{HOSTNAME}}"
381+ }
382+ }
383+ },
384+ "routes" : {
385+ "hypervisor-lxc-docker" : {
386+ "route" : [" hypervisor" , " lxc" , " docker-server" ]
387+ }
388+ },
389+ "records" : {
390+ "*.mydomain.com" : " hypervisor-lxc-docker"
391+ }
392+ }
253393```
254394
255395This setup requires:
0 commit comments