[WIFI-2853] Add: configration generation in runtime via env variables

This commit is contained in:
Dmitry Dunaev
2021-06-30 16:41:15 +03:00
parent fb344db120
commit 77224477b3
3 changed files with 10 additions and 3 deletions

View File

@@ -6,9 +6,10 @@ RUN npm install
COPY . .
RUN echo '{"DEFAULT_GATEWAY_URL": "https://ucentral.dpaas.arilia.com:16001","ALLOW_GATEWAY_CHANGE": true}' > public/config.json \
&& npm run build
RUN npm run build
FROM nginx:1.20.1-alpine AS runtime
COPY --from=build /build/ /usr/share/nginx/html/
COPY --from=build docker-entrypoint.d/40-generate-config.sh /docker-entrypoint.d/40-generate-config.sh

View File

@@ -0,0 +1,6 @@
#!/bin/ash
# Check if variables are set
export DEFAULT_GATEWAY_URL="${DEFAULT_GATEWAY_URL:-https://ucentral.dpaas.arilia.com:16001}"
export ALLOW_GATEWAY_CHANGE="${ALLOW_GATEWAY_CHANGE:-false}"
echo '{"DEFAULT_GATEWAY_URL": "'$DEFAULT_GATEWAY_URL'","ALLOW_GATEWAY_CHANGE": '$ALLOW_GATEWAY_CHANGE'}' > /usr/share/nginx/html/config.json

View File

@@ -1,4 +1,4 @@
{
"DEFAULT_GATEWAY_URL": "https://ucentral.dpaas.arilia.com:16001",
"ALLOW_GATEWAY_CHANGE": false
}
}