Skip to content

Commit d13134c

Browse files
committed
Add env WGUI_MANAGE_RELOAD for support reload wireguard configuration
Signed-off-by: WindSpiritSR <[email protected]>
1 parent a823edb commit d13134c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ These environment variables only apply to the docker container.
105105
|-----------------------|---------------------------------------------------------------|---------|
106106
| `WGUI_MANAGE_START` | Start/stop WireGuard when the container is started/stopped | `false` |
107107
| `WGUI_MANAGE_RESTART` | Auto restart WireGuard when we Apply Config changes in the UI | `false` |
108+
| `WGUI_MANAGE_RELOAD` | Auto reload WireGuard when we Apply Config changes in the UI | `false` |
108109

109110
## Auto restart WireGuard daemon
110111

@@ -198,6 +199,10 @@ running the container with `restart: unless-stopped`. These settings can also pi
198199
Path, after restarting the container. Please make sure you have `--cap-add=NET_ADMIN` in your container config to make
199200
this feature work.
200201

202+
Set `WGUI_MANAGE_RELOAD=true` to manage Wireguard interface reload.
203+
Using `WGUI_MANAGE_RELOAD=true` will use `wg syncconf wg0 /path/to/file` to update the wireguard running-configuration
204+
without restart. Please make sure you have `--cap-add=NET_ADMIN` in your container config to make this feature work.
205+
201206
## Build
202207

203208
### Build docker image

init.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ case $WGUI_MANAGE_RESTART in (1|t|T|true|True|TRUE)
1818
done &
1919
esac
2020

21+
# manage wireguard reload
22+
case $WGUI_MANAGE_RELOAD in (1|t|T|true|True|TRUE)
23+
[[ -f $conf ]] || touch "$conf" # inotifyd needs file to exist
24+
inotifyd - "$conf":w | while read -r event file; do
25+
wg syncconf wg0 <(wg-quick strip wg0)
26+
done &
27+
esac
2128

2229
./wg-ui &
2330
wait $!

0 commit comments

Comments
 (0)