From 79e2db84929de692b4bcbea659941cdfd49b2247 Mon Sep 17 00:00:00 2001 From: v6ole Date: Tue, 4 Aug 2026 16:24:16 +0800 Subject: [PATCH] build: make frontend auth mode configurable --- backend/tests/test_deployment_security.py | 1 + docker-compose.yml | 5 ++++- frontend/Dockerfile | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/tests/test_deployment_security.py b/backend/tests/test_deployment_security.py index 9f59b3e..685fda5 100644 --- a/backend/tests/test_deployment_security.py +++ b/backend/tests/test_deployment_security.py @@ -10,6 +10,7 @@ def test_compose_does_not_embed_password_or_net_admin_capability(): assert "POSTGRES_PASSWORD=pingwatch123" not in compose assert "NET_ADMIN" not in compose assert "PINGWATCH_BACKEND_BIND" in compose + assert "VITE_AUTH_ENABLED" in compose def test_oauth_client_does_not_disable_tls_verification(): diff --git a/docker-compose.yml b/docker-compose.yml index 89b3eea..865f870 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,10 @@ services: - NET_RAW frontend: - build: ./frontend + build: + context: ./frontend + args: + VITE_AUTH_ENABLED: "${VITE_AUTH_ENABLED:-false}" container_name: pingwatch-frontend restart: unless-stopped environment: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index a7f50d3..f230c90 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -4,6 +4,8 @@ FROM node:20-alpine AS builder WORKDIR /app COPY package.json ./ ARG NPM_REGISTRY=https://registry.npmmirror.com +ARG VITE_AUTH_ENABLED=false +ENV VITE_AUTH_ENABLED=$VITE_AUTH_ENABLED RUN npm config set registry "$NPM_REGISTRY" && npm install COPY . . RUN npm run build