adding WG_HOST as next public env

This commit is contained in:
Shahrad Elahi 2023-09-25 15:26:34 +03:30
parent 19b525d1e6
commit 2b6083a692
6 changed files with 25 additions and 16 deletions

View File

@ -48,6 +48,7 @@ RUN npm install
EXPOSE 3000/tcp
COPY docker-entrypoint.sh /usr/bin/entrypoint
RUN chmod +x /usr/bin/entrypoint
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["npm", "run", "start"]

View File

@ -25,6 +25,7 @@ COPY /config/torrc /etc/tor/torrc
EXPOSE 3000/tcp
COPY docker-entrypoint.sh /usr/bin/entrypoint
RUN chmod +x /usr/bin/entrypoint
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["npm", "run", "dev"]

View File

@ -4,6 +4,9 @@ services:
image: wireadmin
volumes:
- ./src/:/app/
ports:
- "4040:4040/udp" # Direct
- "4050:4050/udp" # Tor
environment:
- UI_PASSWORD=password
- WG_HOST=192.168.1.233
- WG_HOST=127.0.0.1

View File

@ -6,18 +6,6 @@ services:
# Change this to your host's public address
- WG_HOST=raspberrypi.local
# Optional:
# - UI_PASSWORD=foobar123
# - WG_PORT=51820
# - WG_DEFAULT_ADDRESS=10.8.0.x
# - WG_DEFAULT_DNS=1.1.1.1
# - WG_MTU=1420
# - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24
# - WG_PRE_UP=echo "Pre Up" > /etc/wireguard/pre-up.txt
# - WG_POST_UP=echo "Post Up" > /etc/wireguard/post-up.txt
# - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt
# - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt
image: shahradel/wireadmin
container_name: wireadmin
volumes:

View File

@ -21,4 +21,9 @@ screen -dmS redis bash -c "redis-server --port 6479 --daemonize no --dir /data -
# Start Tor in the background
screen -dmS tor bash -c "tor -f /etc/tor/torrc"
# If WG_HOST exists, again export it as NEXT_PUBLIC_WG_HOST
if [ ! -z "$WG_HOST" ]; then
export NEXT_PUBLIC_WG_HOST=$WG_HOST
fi
exec "$@"

View File

@ -1,4 +1,15 @@
module.exports = {
function publicENV(ex = {}) {
Object.entries(process.env)
.filter(([ key ]) => key.startsWith('NEXT_PUBLIC_'))
.forEach(([ key, value ]) => ex[key] = value)
return ex
}
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
transpilePackages: ["ui"],
};
transpilePackages: [],
env: publicENV()
}
module.exports = nextConfig;