env template and Dockerfile

This commit is contained in:
dvirlabs 2025-07-01 06:29:35 +03:00
parent 6bb73f0bc5
commit 5fa74043bc
3 changed files with 5 additions and 7 deletions

View File

@ -1,9 +1,7 @@
#!/bin/sh
cat <<EOF > /usr/share/nginx/html/env.js
window.ENV = {
API_BASE: "${API_BASE:-http://localhost:8000}"
};
EOF
# מחליף את הטמפלייט במשתנה האמיתי שהוזן כ־ENV
envsubst < /usr/share/nginx/html/env.js.template > /usr/share/nginx/html/env.js
# מריץ את nginx
exec nginx -g "daemon off;"

View File

@ -1,3 +1,3 @@
window.ENV = {
API_BASE: "${API_BASE}"
API_BASE: "__API_BASE__"
};

View File

@ -19,4 +19,4 @@ spec:
- containerPort: {{ .Values.frontend.port }}
env:
- name: API_BASE
value: "https://{{ .Values.backend.ingress.host }}"
value: {{ .Values.frontend.env.API_BASE | quote }}