chore: merge develop → main (maintenance window 2026-06-28) #7
@@ -1,19 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Inject runtime config from environment variables into the built SPA.
|
|
||||||
# This file is written to /app/dist/config.js and loaded by index.html
|
|
||||||
# BEFORE the Vite bundle — so window.__APP_CONFIG__ is available at startup.
|
|
||||||
#
|
|
||||||
# Add new config values here and in src/lib/api.ts Window interface.
|
|
||||||
|
|
||||||
cat > /app/dist/config.js <<EOF
|
cat > /app/dist/config.js <<EOF
|
||||||
window.__APP_CONFIG__ = {
|
window.__APP_CONFIG__ = {
|
||||||
apiUrl: '${VITE_API_URL:-http://localhost:8080}',
|
apiUrl: '${VITE_API_URL:-http://localhost:8017}'
|
||||||
authUrl: '${VITE_AUTH_URL:-http://localhost:8082}'
|
|
||||||
};
|
};
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo "config.js: apiUrl=${VITE_API_URL:-http://localhost:8080}"
|
echo "config.js: apiUrl=${VITE_API_URL:-http://localhost:8017}"
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
@@ -4,21 +4,20 @@ declare global {
|
|||||||
interface Window {
|
interface Window {
|
||||||
__APP_CONFIG__?: {
|
__APP_CONFIG__?: {
|
||||||
apiUrl?: string;
|
apiUrl?: string;
|
||||||
authUrl?: string;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const API_BASE = window.__APP_CONFIG__?.apiUrl || 'http://localhost:8017';
|
const ariaApiUrl = window.__APP_CONFIG__?.apiUrl || 'http://localhost:8017';
|
||||||
const AUTH_BASE = window.__APP_CONFIG__?.authUrl || 'http://localhost:8082';
|
const gatewayUrl = ariaApiUrl.replace(/\/aria$/, '');
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: API_BASE,
|
baseURL: ariaApiUrl,
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
});
|
});
|
||||||
|
|
||||||
export const authApi = axios.create({
|
export const authApi = axios.create({
|
||||||
baseURL: AUTH_BASE,
|
baseURL: gatewayUrl,
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user