From 957c3667bb502ebbf8a6d0d7dcf41ab895e9f45e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C5=BEe=20=C5=BDitnik?= <anze.zitnik@xlab.si> Date: Mon, 30 May 2022 17:09:21 +0200 Subject: [PATCH] Enable setting of API URL via environment variable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed commit of the following: commit 00434fb53957b52565e4a460292cc8e3fd2645f4 Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Mon May 30 17:09:08 2022 +0200 Version 0.1.5 commit 8c3a83fe8f7bc14cc7f57a605840b62e11c050c5 Merge: 41cff35a f05e3580 Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Mon May 30 15:08:02 2022 +0000 Merge branch 'settable-api-url' into 'develop' Enable setting of API URL via environment variable. See merge request medina/cce-frontend!4 commit f05e358045e4fb82d710f86d2cdd8dafe09b3974 Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Mon May 30 15:08:01 2022 +0000 Enable setting of API URL via environment variable. commit 41cff35a9d279d66038ce17dffb1a6f0a2780b74 Merge: a83a43f5 0e63df2e Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Mon May 30 15:48:32 2022 +0200 Merge branch 'master' into develop commit a83a43f586014412b6bb9b90e9bb1e22d822a1da Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Mon May 30 13:31:46 2022 +0200 Version 0.1.4 commit 05820fd40a5c015c0bcdbad8435d74a5c8ea83ac Merge: a19afbab 023e3fdd Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Mon May 30 11:30:14 2022 +0000 Merge branch 'auto-collapse' into 'develop' Start with collapsed nodes See merge request medina/cce-frontend!3 commit 023e3fddbe77f1b9f04ca796cbfbf530ee37b301 Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Mon May 30 11:30:14 2022 +0000 Start with collapsed nodes commit a19afbabad93e6654d7eefdf3c78335d5c051e6b Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Fri May 27 13:33:56 2022 +0200 Version up: 0.1.3 commit a2bf39a78579f0c17b215e96026a5a7c9edf9270 Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Thu May 26 17:39:06 2022 +0200 Add targetValue property. Rearrange properties in infoBox. Don't show 'code' if same as 'name'. commit d7dd3b66c66fc8718787e1347c6f72f405fc1dfa Merge: 0bedbed3 dc3d4b90 Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Fri May 20 10:04:47 2022 +0200 Merge branch 'master' into develop commit 0bedbed33cd8a0f5e58a570e51f7cdfe6d854f3f Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Fri May 20 10:00:02 2022 +0200 Minor fix in instructions. commit 8df42ada6f9eab247280c26b8518661ed721681f Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Fri May 20 09:47:09 2022 +0200 Revert "Updated getting for CI from package.json" This reverts commit 64b5b5152b2e065db8b31313ed756a8df10d61e2. commit e318c48589b14d32dd727584926c1318016192bb Author: Anže Žitnik <anze.zitnik@xlab.si> Date: Fri May 20 09:31:26 2022 +0200 Version up - 1.1.2 commit 95f07516f8593fdfc4e1c43e13020b6909cc661f Author: Aljaz Nuncic <aljaz.nuncic@xlab.si> Date: Thu May 19 19:26:49 2022 +0200 Added word breaking, permanent node description box option, instructions commit 64b5b5152b2e065db8b31313ed756a8df10d61e2 Author: Aljaz Nuncic <aljaz.nuncic@xlab.si> Date: Thu May 19 19:25:53 2022 +0200 Updated getting for CI from package.json --- .env.production | 2 +- Dockerfile | 4 +++- README.md | 7 +++---- entrypoint.sh | 5 +++++ package.json | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 entrypoint.sh diff --git a/.env.production b/.env.production index 06db81f7..58fe7e1d 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -VUE_APP_API="https://cce-api-dev.k8s.medina.esilab.org" +VUE_APP_API="<<CCE_API_URL>>" diff --git a/Dockerfile b/Dockerfile index 18a2c573..0b6c311e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ RUN rm -rf /usr/share/nginx/html/* # Copy from build stage COPY --from=build-stage /app/dist /usr/share/nginx/html +COPY --from=build-stage /app/entrypoint.sh /root +RUN chmod u+x /root/entrypoint.sh EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD /root/entrypoint.sh \ No newline at end of file diff --git a/README.md b/README.md index f4697bf1..f17d8a1a 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,7 @@ docker run -p 8081:80 registry-gitlab.xlab.si/medina/cce-frontend:latest Before pushing to master check if version needs to be updated in [package.json](package.json#L3). This version is also used for tagging docker image at CI. -## Setting API url +## Setting API URL -You can set the API URL in the environment file. -For local development (npm run serve) it is set in [.env.development](.env.development) and for production (docker run) in [.env.production](.env.production). -The environment must be set up before build. \ No newline at end of file +You can set the API URL using the `CCE_API_URL` environment variable. +By default (if unset) the URL used is MEDINA k8s dev deploy: https://cce-api-dev.k8s.medina.esilab.org diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..5278b11c --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +URL="${CCE_API_URL:-https://cce-api-dev.k8s.medina.esilab.org}" + +sed -i "s|<<CCE_API_URL>>|${CCE_API_URL}|" /usr/share/nginx/html/js/app.*.js + +nginx -g 'daemon off;' diff --git a/package.json b/package.json index 3dc04d1f..f884e8e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cce-frontend", - "version": "0.1.4", + "version": "0.1.5", "private": true, "scripts": { "serve": "vue-cli-service serve", -- GitLab