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

View File

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

View File

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