docker
docker copied to clipboard
Improve environment variable from file support
The environment variable from file support is currently very fragmented on the PHP side.
https://github.com/nextcloud/docker/blob/31c59aea24f8516f862ca136766168016e840593/.config/autoconfig.php#L9-L37
This is extremely fragile, as it is all or nothing with the _FILE
environment variables - and to complicate things, one of them is non-_FILE
. Note that some environment variables such as these must also be supported in the entrypoint script.
https://github.com/nextcloud/docker/blob/31c59aea24f8516f862ca136766168016e840593/.config/smtp.config.php#L15-L21
These should be refactored to use a common function f(string) -> string
that returns the environment variable value given its name and an optional default (no matter whether it is from file or not). There is already a somewhat parallel idea implemented in the entrypoint script -
https://github.com/nextcloud/docker/blob/31c59aea24f8516f862ca136766168016e840593/docker-entrypoint.sh#L22-L26
Related to https://github.com/nextcloud/docker/issues/1938