Config file to be read at runtime
The problem:
Kotahi and Editoria need to be deployed for several clients, each with a different server. Some environment variables, most importantly ones about the server url, need to be there at build time. This ends up meaning that we need to build different images for each client. Ideally we'd have a single image that is reused with different configuration.
Proposed solution:
We allow injection of a config.js
file via a docker volume. This can be as simple as just containing the server url.
Then in the client file that determines the server url, we can:
- Check if the environment variables were defined at build time. If yes, use those. This will keep backwards compatibility.
- If not, check if a config file exists / has been mounted. If yes, read it and grab the server url from there.