Autoconfig environment `_FILE` variables
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 7.4k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
I just spent 1 hour googling and experimenting with my docker setup because nextcloud container would always use sqlite database no matter what I did.
Finally decided to look into the code and found https://github.com/nextcloud/docker/blob/f9ae675c1ac2aed735435e84dd1794eb28890103/.config/autoconfig.php#L23-L37
I think it's confusing to say that _FILE suffix is supported but not mentioning that if you want to use ONE variable from file (ie POSTGRES_PASSWORD), you have to use ALL variables from file...
Rather than documenting this behavior, I think it'd be more interesting to fix it and allow each variable independently such as
# pseudo-code
check_env($variable) {
return getenv($variable) || getenv($variable + "_FILE")
}
...
} elseif (check_env('POSTGRES_DB_FILE') && check_env('POSTGRES_USER_FILE') && check_env('POSTGRES_PASSWORD_FILE') && check_env('POSTGRES_HOST')) {
...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in .config/autoconfig.php at lines 23-37 and inspect how the environment variables and their _FILE variants are checked. Reproduce the reported Docker setup with only POSTGRES_PASSWORD supplied from a file, then verify that each variable can independently use either form without forcing all database settings to come from files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, php
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100