From 87b08a8f7c026e325438b18a1d7384fd33847e5c Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Mon, 25 Apr 2022 00:17:13 -0700 Subject: [PATCH] *: allows for BASE_PATH configuration (#183) --- Dockerfile | 16 ++++++--- README.md | 2 ++ custom/js/helper.js | 2 +- handler/routes.go | 4 +-- handler/session.go | 4 +-- main.go | 60 +++++++++++++++++--------------- templates/base.html | 50 +++++++++++++------------- templates/clients.html | 16 ++++----- templates/global_settings.html | 2 +- templates/login.html | 17 +++++---- templates/server.html | 4 +-- templates/wake_on_lan_hosts.html | 2 +- util/config.go | 13 +++++++ 13 files changed, 108 insertions(+), 84 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b3e5e4..3e1812f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,11 @@ RUN apk add --update --no-cache ${BUILD_DEPENDENCIES} WORKDIR /build -# Add sources -COPY . /build +# Add dependencies +COPY go.mod /build +COPY go.sum /build +COPY package.json /build +COPY yarn.lock /build # Prepare assets RUN yarn install --pure-lockfile --production && \ @@ -39,13 +42,16 @@ RUN mkdir -p assets/plugins && \ /build/node_modules/jquery-tags-input/ \ assets/plugins/ -# Move custom assets -RUN cp -r /build/custom/ assets/ - # Get go modules and build tool RUN go mod download && \ go get github.com/GeertJohan/go.rice/rice +# Add sources +COPY . /build + +# Move custom assets +RUN cp -r /build/custom/ assets/ + # Build RUN rice embed-go && \ CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o wg-ui . diff --git a/README.md b/README.md index 0940706..ee3bb44 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Set the `SESSION_SECRET` environment variable to a random value. To use custom `wg.conf` template set the `WG_CONF_TEMPLATE` environment variable to a path to such file. Make sure `wireguard-ui` will be able to work with it - use [default template](templates/wg.conf) for reference. +Set the `BASE_PATH` environment variable if you run wireguard-ui under a subpath of your reverse proxy virtual host (e.g. /wireguard). + In order to sent the wireguard configuration to clients via email, set the following environment variables: - using SendGrid API diff --git a/custom/js/helper.js b/custom/js/helper.js index b742472..86f6dc7 100644 --- a/custom/js/helper.js +++ b/custom/js/helper.js @@ -26,7 +26,7 @@ function renderClientList(data) {
{{if .baseData.CurrentUser}} - {{end}}
@@ -75,7 +75,7 @@