Fix google auth url

This commit is contained in:
dvirlabs 2025-12-31 01:59:48 +02:00
parent 0c33068398
commit 2c5668d21e
5 changed files with 21 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
tasko-chart/
invy-chart/
values.yaml

View File

@ -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"]

View File

@ -5,6 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Wedding Guest List</title>
<script src="/config.js"></script>
</head>
<body>
<div id="root"></div>

View File

@ -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,

View File

@ -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`
}