Regular → Executable
+2
-3
@@ -1,11 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Create runtime env-config.js for the static app
|
|
||||||
cat > /usr/share/nginx/html/env-config.js <<EOF
|
cat > /usr/share/nginx/html/env-config.js <<EOF
|
||||||
window.__ENV__ = {
|
window.__ENV__ = {
|
||||||
VITE_AUTH_API: "${VITE_AUTH_API:-http://localhost:5000}",
|
AUTH_API: "${AUTH_API:-http://localhost:5000}",
|
||||||
VITE_TRANSIT_API: "${VITE_TRANSIT_API:-http://localhost:5001}"
|
TRANSIT_API: "${TRANSIT_API:-http://localhost:5001}"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
window.__ENV__ = {
|
|
||||||
VITE_AUTH_API: 'http://localhost:5000',
|
|
||||||
VITE_TRANSIT_API: 'http://localhost:5001'
|
|
||||||
}
|
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
const RUNTIME = typeof window !== 'undefined' && window.__ENV__ ? window.__ENV__ : {}
|
const RUNTIME = typeof window !== 'undefined' && window.__ENV__ ? window.__ENV__ : {}
|
||||||
const AUTH_API = RUNTIME.VITE_AUTH_API || import.meta.env.VITE_AUTH_API || 'http://localhost:5000'
|
const AUTH_API = RUNTIME.AUTH_API || import.meta.env.VITE_AUTH_API || 'http://localhost:5000'
|
||||||
const TRANSIT_API = RUNTIME.VITE_TRANSIT_API || import.meta.env.VITE_TRANSIT_API || 'http://localhost:5001'
|
const TRANSIT_API = RUNTIME.TRANSIT_API || import.meta.env.VITE_TRANSIT_API || 'http://localhost:5001'
|
||||||
|
|
||||||
export const authClient = axios.create({ baseURL: AUTH_API })
|
export const authClient = axios.create({ baseURL: AUTH_API })
|
||||||
export const transitClient = (token) => axios.create({
|
export const transitClient = (token) => axios.create({
|
||||||
|
|||||||
+2
-2
@@ -54,8 +54,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5174:80"
|
- "5174:80"
|
||||||
environment:
|
environment:
|
||||||
VITE_AUTH_API: /api/auth
|
AUTH_API: ${AUTH_API}
|
||||||
VITE_TRANSIT_API: /api/transit
|
TRANSIT_API: ${TRANSIT_API}
|
||||||
depends_on:
|
depends_on:
|
||||||
- auth_api
|
- auth_api
|
||||||
- transit_api
|
- transit_api
|
||||||
|
|||||||
Reference in New Issue
Block a user