In certain environments like on Docker, Kubernetes or OpenShift applications usually get configured using environment variables. These apps follow The Twelve-Factor App principles.
Is it possible to configure certain settings in Nextcloud like database parameters using environment variables?
I don’t know for sure, but I’m not aware of any environment variables that Nextcloud uses. It just uses a config file like you see above. So apparently Nextcloud fails factor 3 of the twelve-factor app principles.
Yes. that’s true, but I don’t want only define environment variables for the installation process. I am looking for environment variables which are equivalent with the settings I can define in the config.php file.
Oops I was wrong, after reviewing that pull request referenced from a couple years ago, it looks like you can just take any key you can use in config.php and prefix it with NC_ as an environment variable, and that overrides whatever is in config.php. I’m not sure if that’s in the documentation anywhere but that’s what the code does.
This is an old topic, but I stumbled upon it and while it says it’s solved, the linked PR doesn’t give a concrete example which I think would be useful, though.
In general the configuration via env vars seems to be possible but inconsistent before that PR.
For instance you can indeed configure the data directory like this:
NEXTCLOUD_DATA_DIR=/…
Now the trusted_proxies?
Surely that would be NEXTCLOUD_TRUSTED_PROXIES. But no, it’s just TRUSTED_PROXIES.
But as implemented in the PR linked by @tobru, You can indeed just put everything into the environment prefixed with NC_! Thanks for the hint.
For instance I added the following to get rid of some warnings in the administration: