Configuration principles
Docker and configuration
Docker enforces a separation between running code (contained in docker images) and configuration of said running code. Docker provides two ways of supplying configuration to code running in containers : environment variables and file injection.
Env variables
Docker is able to pass arbitrary environment variables to code running in containers.
Environment variables are the prefered way to pass configuration to code running in containers but have one limitation : configuration data must be a string of characters. No JSON, no YAML, just a string.
In 4ME ecosystem, this way is prefered for most configuration.
File injection
The other configuration model available to Docker applications is file injection. Docker is able to mount or inject a file (or a directory) from the host file system to the container file system. Complex configuration data (such as JSON) can be injected this way.
Frontend configuration
Frontend code runs in a browser in the form of a javascript bundle. The browser has to load a configuration file from the remote server.
In 4ME, this is done via the config.js
file. This file is injected in the web server container, served by the web server and finally loaded by the browser.