nextcloud / nextcloud/docker

Improve environment variable from file support

Open
#1,940 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

3. to review enhancement feature: auto config (Docker secrets) needs review technical debt
Dominant language
Shell
Stars
7.4k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

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

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

Read .config/autoconfig.php and .config/smtp.config.php alongside docker-entrypoint.sh, focusing on their existing environment-variable and _FILE handling. Trace which variables need support in both PHP configuration and the entrypoint. Done means the fragmented handling uses a common f(string) -> string function with optional defaults while preserving the required environment-variable behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php, shell
Domain
devops
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.