From 6496b13d498e9f1832e663cc4969e9c37a3492ab Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Mon, 2 Feb 2026 20:45:54 +0200 Subject: [PATCH] Fix user and password for the app --- .gitignore | 1 + frontend/Dockerfile | 4 +++- frontend/src/components/Login.jsx | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index f0dd841..eb51957 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ tasko-chart/ invy-chart/ +invy/ values.yaml \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 8533692..8ba328b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -62,7 +62,9 @@ COPY --from=build /app/dist /usr/share/nginx/html # Create entrypoint script for runtime config RUN echo '#!/bin/sh' > /docker-entrypoint.sh && \ echo 'echo "window.ENV = {" > /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ - echo 'echo " VITE_API_URL: \"${VITE_API_URL:-http://localhost:8000}\"" >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ + echo 'echo " VITE_API_URL: \"${VITE_API_URL:-http://localhost:8000}\"," >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ + echo 'echo " VITE_ADMIN_USERNAME: \"${VITE_ADMIN_USERNAME:-admin}\"," >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ + echo 'echo " VITE_ADMIN_PASSWORD: \"${VITE_ADMIN_PASSWORD:-wedding2025}\"" >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ echo 'echo "}" >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ echo 'exec nginx -g "daemon off;"' >> /docker-entrypoint.sh && \ chmod +x /docker-entrypoint.sh diff --git a/frontend/src/components/Login.jsx b/frontend/src/components/Login.jsx index 44b8580..97fe844 100644 --- a/frontend/src/components/Login.jsx +++ b/frontend/src/components/Login.jsx @@ -12,9 +12,9 @@ function Login({ onLogin }) { e.preventDefault() setError('') - // Simple authentication - you can change these credentials - const ADMIN_USERNAME = 'admin' - const ADMIN_PASSWORD = 'wedding2025' + // Get credentials from runtime config (set via Helm values) + const ADMIN_USERNAME = window.ENV?.VITE_ADMIN_USERNAME || import.meta.env.VITE_ADMIN_USERNAME || 'admin' + const ADMIN_PASSWORD = window.ENV?.VITE_ADMIN_PASSWORD || import.meta.env.VITE_ADMIN_PASSWORD || 'wedding2025' if (credentials.username === ADMIN_USERNAME && credentials.password === ADMIN_PASSWORD) { localStorage.setItem('isAuthenticated', 'true')