Skip to content

Commit

Permalink
Add PreUp/PostUp/PreDown/PostDown to env variables for server.conf cr…
Browse files Browse the repository at this point in the history
…eation
  • Loading branch information
Christoph Spörk committed Sep 19, 2021
1 parent 872781c commit 3487061
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ $ subspace --http-host subspace.example.com
| `SUBSPACE_THEME` | `green` | The theme to use, please refer to [semantic-ui](https://semantic-ui.com/usage/theming.html) for accepted colors |
| `SUBSPACE_BACKLINK` | `/` | The page to set the home button to |
| `SUBSPACE_DISABLE_DNS` | `false` | Whether to disable DNS so the client uses their own configured DNS server(s). Consider disabling DNS server, if supporting international VPN clients |

| `SUBSPACE_PREUP` | null | PreUp=Action for wireguard server interface |
| `SUBSPACE_PREDOWN` | null | PreDown=Action for wireguard server interface |
| `SUBSPACE_POSTUP` | null | PostUp=Action for wireguard server interface |
| `SUBSPACE_POSTDOWN` | null | PostDown=Action for wireguard server interface |
### Run as a Docker container

#### Install WireGuard on the host
Expand Down
18 changes: 18 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,24 @@ PrivateKey = $(cat /data/wireguard/server.private)
ListenPort = ${SUBSPACE_LISTENPORT}
WGSERVER

if [ -n $SUBSPACE_PREUP ];
then
echo "PreUp=$SUBSPACE_PREUP" >> /data/wireguard/server.conf
fi
if [ -n $SUBSPACE_PREDOWN ];
then
echo "PreDown=$SUBSPACE_PREDOWN" >> /data/wireguard/server.conf
fi
if [ -n $SUBSPACE_POSTUP ];
then
echo "PostUp=$SUBSPACE_POSTUP" >> /data/wireguard/server.conf
fi
if [ -n $SUBSPACE_POSTDOWN ];
then
echo "PostDown=$SUBSPACE_POSTDOWN" >> /data/wireguard/server.conf
fi

cat /data/wireguard/peers/*.conf >>/data/wireguard/server.conf
umask ${umask_val}
[ -f /data/config.json ] && chmod 600 /data/config.json # Special handling of file not created by start-up script
Expand Down

0 comments on commit 3487061

Please sign in to comment.