Skip to content

Commit 525a507

Browse files
committed
add raw query to skip query building
1 parent 5dd7268 commit 525a507

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

.github/templates/README.template.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,17 @@ The `hosts` section defines all machines, VMs, containers, or Docker services th
9191
| `mac` | string | Required for PHYSICAL | MAC address for Wake-on-LAN. Only needed for physical hosts. |
9292
| `addr` | string | Optional, PHYSICAL only | The network address used to send WoL packets, if different from `ip`. |
9393
| `id` | string | Required for VIRTUAL | Identifier for virtual machines or LXCs. |
94-
| `virtIP` | string | Optional | IP of the VM/LXC. Defaults to `ip`. |
94+
| `virtIP` | string | Optional | IP of the VM/LXC, used for pings. Defaults to `ip`. |
9595
| `startupTime` | number | Optional | Seconds to wait after starting before pinging IP. |
9696
| `url` | string | Optional | Override the default helper URL for this host. |
9797
| `docker: true` | boolean | Optional | Can be set to `true` to mark a host as DOCKER type without additional settings. |
9898
| `docker` | object | Required for DOCKER type | Docker-specific settings. See below. |
9999

100-
### Docker Sub-Object
100+
### Docker Sub-Object (`docker`)
101101

102102
| Field | Type | Required | Description |
103103
| -------------- | ------ | -------- | ------------------------------------------------------------------------------------------ |
104+
| `query` | string | Optional | Raw query used for WoL Dockerized. Skips building query with `queryPattern`. |
104105
| `queryPattern` | string | Optional | Template used to build the query for WoL Dockerized. Falls back to `ENV.woldQueryPattern`. |
105106
| `url` | string | Optional | Override URL for Docker wake API. Defaults to `http://${host.ip}:${ENV.woldPort}/wake`. |
106107

@@ -110,14 +111,6 @@ The `hosts` section defines all machines, VMs, containers, or Docker services th
110111
- **VIRTUAL** → has `id`
111112
- **DOCKER** → has `docker` object or `docker: true`
112113

113-
### Notes on Optional Overrides
114-
115-
- `addr` allows sending WoL packets to a different network address than `ip`, useful for hosts behind different subnets or NAT.
116-
- `url` can override default helper URLs for PHYSICAL, VIRTUAL, or DOCKER hosts.
117-
- `virtIP` can override the IP used for pings.
118-
- `docker.queryPattern` can override the global `ENV.woldQueryPattern`.
119-
- The execution order of hosts in a route determines the startup sequence.
120-
121114
## Advanced Setups
122115

123116
WoL Redirect supports two main scenarios depending on how your services are hosted.

src/wol.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,22 @@ function getDataFromHost(host, serviceUrl) {
158158
return null
159159
}
160160

161-
const queryPattern = host.docker.queryPattern || ENV.woldQueryPattern
162-
const context = {
163-
HOST: serviceURL.host,
164-
HOSTNAME: serviceURL.hostname,
165-
PORT: serviceURL.port || "",
166-
PROTOCOL: serviceURL.protocol,
167-
PATH: serviceURL.pathname,
168-
}
161+
let query = ""
162+
163+
if (host.docker?.query) {
164+
query = host.docker.query
165+
} else {
166+
const queryPattern = host.docker.queryPattern || ENV.woldQueryPattern
167+
const context = {
168+
HOST: serviceURL.host,
169+
HOSTNAME: serviceURL.hostname,
170+
PORT: serviceURL.port || "",
171+
PROTOCOL: serviceURL.protocol,
172+
PATH: serviceURL.pathname,
173+
}
169174

170-
const query = buildQuery(queryPattern, context)
175+
query = buildQuery(queryPattern, context)
176+
}
171177

172178
return {
173179
url: woldUrl,

0 commit comments

Comments
 (0)