From 2c5668d21e56e838834a2021fa2d4961436676ba Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Wed, 31 Dec 2025 01:59:48 +0200 Subject: [PATCH] Fix google auth url --- .gitignore | 3 ++- frontend/Dockerfile | 18 ++++++++++++++++-- frontend/index.html | 1 + frontend/src/api/api.js | 2 +- frontend/src/components/GoogleImport.jsx | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 47cb8fa..f0dd841 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tasko-chart/ -invy-chart/ \ No newline at end of file +invy-chart/ +values.yaml \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index b1f9711..8533692 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -43,6 +43,12 @@ RUN echo 'server {' > /etc/nginx/conf.d/default.conf && \ echo ' try_files $uri $uri/ /index.html;' >> /etc/nginx/conf.d/default.conf && \ echo ' }' >> /etc/nginx/conf.d/default.conf && \ echo '' >> /etc/nginx/conf.d/default.conf && \ + echo ' # Serve runtime config' >> /etc/nginx/conf.d/default.conf && \ + echo ' location /config.js {' >> /etc/nginx/conf.d/default.conf && \ + echo ' expires -1;' >> /etc/nginx/conf.d/default.conf && \ + echo ' add_header Cache-Control "no-store, no-cache, must-revalidate";' >> /etc/nginx/conf.d/default.conf && \ + echo ' }' >> /etc/nginx/conf.d/default.conf && \ + echo '' >> /etc/nginx/conf.d/default.conf && \ echo ' # Cache static assets' >> /etc/nginx/conf.d/default.conf && \ echo ' location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {' >> /etc/nginx/conf.d/default.conf && \ echo ' expires 1y;' >> /etc/nginx/conf.d/default.conf && \ @@ -53,9 +59,17 @@ RUN echo 'server {' > /etc/nginx/conf.d/default.conf && \ # Copy built files from build stage 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 "}" >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ + echo 'exec nginx -g "daemon off;"' >> /docker-entrypoint.sh && \ + chmod +x /docker-entrypoint.sh + # Expose port 80 EXPOSE 80 -# Start nginx -CMD ["nginx", "-g", "daemon off;"] +# Start nginx with entrypoint +CMD ["/docker-entrypoint.sh"] diff --git a/frontend/index.html b/frontend/index.html index ddb3985..615996f 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,6 +5,7 @@ Wedding Guest List +
diff --git a/frontend/src/api/api.js b/frontend/src/api/api.js index 2e15d4e..7eb6569 100644 --- a/frontend/src/api/api.js +++ b/frontend/src/api/api.js @@ -1,6 +1,6 @@ import axios from 'axios' -const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000' +const API_BASE_URL = window.ENV?.VITE_API_URL || import.meta.env.VITE_API_URL || 'http://localhost:8000' const api = axios.create({ baseURL: API_BASE_URL, diff --git a/frontend/src/components/GoogleImport.jsx b/frontend/src/components/GoogleImport.jsx index c362f10..c06a596 100644 --- a/frontend/src/components/GoogleImport.jsx +++ b/frontend/src/components/GoogleImport.jsx @@ -28,7 +28,7 @@ function GoogleImport({ onImportComplete }) { const handleGoogleImport = () => { setImporting(true) // Redirect to backend OAuth endpoint (owner will be extracted from email) - const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000' + const apiUrl = window.ENV?.VITE_API_URL || import.meta.env.VITE_API_URL || 'http://localhost:8000' window.location.href = `${apiUrl}/auth/google` }