mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-20 20:03:39 +03:00
Add env WGUI_MANAGE_RELOAD for support reload wireguard configuration
Signed-off-by: WindSpiritSR <simon343riley@gmail.com>
This commit is contained in:
parent
2fdafd34ca
commit
83902508e8
2 changed files with 12 additions and 0 deletions
|
@ -105,6 +105,7 @@ These environment variables only apply to the docker container.
|
||||||
|-----------------------|---------------------------------------------------------------|---------|
|
|-----------------------|---------------------------------------------------------------|---------|
|
||||||
| `WGUI_MANAGE_START` | Start/stop WireGuard when the container is started/stopped | `false` |
|
| `WGUI_MANAGE_START` | Start/stop WireGuard when the container is started/stopped | `false` |
|
||||||
| `WGUI_MANAGE_RESTART` | Auto restart WireGuard when we Apply Config changes in the UI | `false` |
|
| `WGUI_MANAGE_RESTART` | Auto restart WireGuard when we Apply Config changes in the UI | `false` |
|
||||||
|
| `WGUI_MANAGE_RELOAD` | Auto reload WireGuard when we Apply Config changes in the UI | `false` |
|
||||||
|
|
||||||
## Auto restart WireGuard daemon
|
## Auto restart WireGuard daemon
|
||||||
|
|
||||||
|
@ -198,6 +199,10 @@ running the container with `restart: unless-stopped`. These settings can also pi
|
||||||
Path, after restarting the container. Please make sure you have `--cap-add=NET_ADMIN` in your container config to make
|
Path, after restarting the container. Please make sure you have `--cap-add=NET_ADMIN` in your container config to make
|
||||||
this feature work.
|
this feature work.
|
||||||
|
|
||||||
|
Set `WGUI_MANAGE_RELOAD=true` to manage WireGuard interface reload.
|
||||||
|
Using `WGUI_MANAGE_RELOAD=true` will use `wg syncconf wg0 /path/to/file` to update the WireGuard running-configuration
|
||||||
|
without restart. Please make sure you have `--cap-add=NET_ADMIN` in your container config to make this feature work.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
### Build docker image
|
### Build docker image
|
||||||
|
|
7
init.sh
7
init.sh
|
@ -18,6 +18,13 @@ case $WGUI_MANAGE_RESTART in (1|t|T|true|True|TRUE)
|
||||||
done &
|
done &
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# manage wireguard reload
|
||||||
|
case $WGUI_MANAGE_RELOAD in (1|t|T|true|True|TRUE)
|
||||||
|
[[ -f $conf ]] || touch "$conf" # inotifyd needs file to exist
|
||||||
|
inotifyd - "$conf":w | while read -r event file; do
|
||||||
|
wg syncconf wg0 <(wg-quick strip wg0)
|
||||||
|
done &
|
||||||
|
esac
|
||||||
|
|
||||||
./wg-ui &
|
./wg-ui &
|
||||||
wait $!
|
wait $!
|
||||||
|
|
Loading…
Add table
Reference in a new issue