Open-EO / openeo-web-editor

An interactive and easy to use web-based editor for the OpenEO API.
https://editor.openeo.org
Apache License 2.0
12 stars 17 forks source link

support for environment variable `CLIENT_URL` at runtime #275

Closed LukasLohoff closed 2 years ago

LukasLohoff commented 2 years ago

Hi all,

I'm running an openeo-web-editor that runs locally via docker at https://localhost/openeo-editor/. To configure this I tried setting CLIENT_URL environment variable to /openeo-editor/. The variable is picked up and I can see it's active by inspecting the docker container. However, the setting has no effect on the web app. I think this is the case because it has to be active while npm run build is executed.

It works if I provide the environment at build time. For this I have to build my own image like this:

docker build --build-arg CLIENT_URL=/openeo-editor/ .

Do you think it's possible to also support CLIENT_URL at runtime? Or am I missing something else and this should normally work?

m-mohr commented 2 years ago

CLIENT_URL at runtime doesn't work, the data needs to be present at build-time as it is needed by the build tool to correctly set the paths in the JS and HTML sources.

I'm not maintaining the Docker image myself and can't help with it. @mmacata is maintaining it and might be able to say whether it is possible to somehow add an argument so that it can be passed to the npm run build command?

mmacata commented 2 years ago

Technically it would be possible to move the npm run build command to docker CMD, so it wouldn't be executed at build time but when the docker container is started. This way the docker image on dockerhub could be used for different CLIENT_URLs.

What is not so nice about this solution is that there really isn't anything built then during docker build and also the github action would succeed even though the build command could fail later.

In conclusion I would prefer the solution that exists now and when configuration is needed, a separate build must happen.