From 69e1f35886c7e6b53276873d30a44bdbc26414a5 Mon Sep 17 00:00:00 2001 From: Resistencia Dev Date: Tue, 23 Dec 2025 00:00:03 +0100 Subject: [PATCH] feat: make admin dashboard password configurable via env variable NEXT_PUBLIC_ADMIN_PASSWORD --- client/Dockerfile | 7 ++++++- client/src/app/dashboard/page.tsx | 2 +- docker-compose_prod.yml | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/Dockerfile b/client/Dockerfile index 906c3e3..51095e5 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,7 +1,12 @@ FROM node:20-alpine -# Build argument for API URL +# Build arguments ARG NEXT_PUBLIC_API_URL=http://localhost:4000 +ARG NEXT_PUBLIC_ADMIN_PASSWORD=admin123 + +# Make args available as env vars during build +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_ADMIN_PASSWORD=$NEXT_PUBLIC_ADMIN_PASSWORD # Create app directory WORKDIR /app diff --git a/client/src/app/dashboard/page.tsx b/client/src/app/dashboard/page.tsx index 8559b1a..6d1cd25 100644 --- a/client/src/app/dashboard/page.tsx +++ b/client/src/app/dashboard/page.tsx @@ -5,7 +5,7 @@ import { motion, AnimatePresence } from 'framer-motion'; import { useSocket } from '../../hooks/useSocket'; import { Shield, Users, Gamepad2, LogOut, Clock, History, UserMinus, Key, ChevronDown } from 'lucide-react'; -const ADMIN_PASSWORD = "admin123"; +const ADMIN_PASSWORD = process.env.NEXT_PUBLIC_ADMIN_PASSWORD || "admin123"; export default function Dashboard() { const { socket, isConnected } = useSocket(); diff --git a/docker-compose_prod.yml b/docker-compose_prod.yml index c28d3c2..88e91fa 100644 --- a/docker-compose_prod.yml +++ b/docker-compose_prod.yml @@ -7,6 +7,7 @@ services: dockerfile: client/Dockerfile args: - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-https://api.franciaocupada.martivich.es} + - NEXT_PUBLIC_ADMIN_PASSWORD=${NEXT_PUBLIC_ADMIN_PASSWORD:-admin123} ports: - "3000:3000" volumes: @@ -15,6 +16,7 @@ services: - /app/client/node_modules environment: - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-https://api.franciaocupada.martivich.es} + - NEXT_PUBLIC_ADMIN_PASSWORD=${NEXT_PUBLIC_ADMIN_PASSWORD:-admin123} depends_on: - server networks: