nextcloud / nextcloud/docker

Autoconfig environment `_FILE` variables

Open
#2,062 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs enhancement feature: auto config (Docker secrets) needs review
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.