Regular → Executable
+2
-3
@@ -1,11 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Create runtime env-config.js for the static app
|
||||
cat > /usr/share/nginx/html/env-config.js <<EOF
|
||||
window.__ENV__ = {
|
||||
VITE_AUTH_API: "${VITE_AUTH_API:-http://localhost:5000}",
|
||||
VITE_TRANSIT_API: "${VITE_TRANSIT_API:-http://localhost:5001}"
|
||||
AUTH_API: "${AUTH_API:-http://localhost:5000}",
|
||||
TRANSIT_API: "${TRANSIT_API:-http://localhost:5001}"
|
||||
}
|
||||
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'
|
||||
|
||||
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 TRANSIT_API = RUNTIME.VITE_TRANSIT_API || import.meta.env.VITE_TRANSIT_API || 'http://localhost:5001'
|
||||
const AUTH_API = RUNTIME.AUTH_API || import.meta.env.VITE_AUTH_API || 'http://localhost:5000'
|
||||
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 transitClient = (token) => axios.create({
|
||||
|
||||
Reference in New Issue
Block a user