Skip to content

docs(docker): clarify env sync omission behavior - #43706

Closed
keith991001 wants to merge 2 commits into
langgenius:mainfrom
keith991001:codex/fix-env-sync-guidance
Closed

keith991001 wants to merge 2 commits into
langgenius:mainfrom
keith991001:codex/fix-env-sync-guidance

Conversation

@keith991001

Copy link
Copy Markdown
Contributor

Summary

  • clarify that environment values are retained only for variables still present in .env.example
  • document that custom comments, ordering, and variables absent from the template are available from the backup
  • update the Shell and Python warnings to describe which variables will be omitted from the rewritten .env

Root cause

Both synchronization implementations rebuild .env exclusively from .env.example. Values are preserved only when their variable names remain in the template, while variables absent from the template are omitted. The existing documentation and warnings described this behavior incorrectly.

Test plan

  • git diff --check
  • bash -n docker/dify-env-sync.sh
  • Python 3.12 CLI validation
  • temporary fixture validation for retained, newly added, omitted, and backed-up variables

Closes #43703

AI-assisted: Prepared with Codex and reviewed by the contributor.

The sync tools rebuild .env from .env.example, so variables absent from the template are omitted even though the documentation claimed that all custom settings were preserved. Clarify the exact retention and backup behavior, and make both implementations warn about the impending omission instead of asking users to remove values that the sync will already drop.

AI-assisted: Prepared with Codex and reviewed by the contributor.

Test Plan:

```bash
git diff --check
bash -n docker/dify-env-sync.sh
/Users/keith/.local/share/uv/python/cpython-3.12-macos-aarch64-none/bin/python3.12 docker/dify-env-sync.py --help
```
@keith991001
keith991001 requested a review from laipz8200 as a code owner October 8, 2026 13:32
@ghfind-review ghfind-review Bot added the review: medium ghfind author score; see https://ghfind.com label Oct 8, 2026
@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 8, 2026
SuperLinter evaluates the entire modified shell script, exposing pre-existing SC2155 and SC2188 warnings. Separate declarations from command substitutions and use an explicit no-op for file initialization without changing synchronization behavior.

AI-assisted: Prepared with Codex and reviewed by the contributor.

Test Plan:

```bash
/opt/homebrew/bin/shellcheck --severity=warning docker/dify-env-sync.sh
bash -n docker/dify-env-sync.sh
git diff --check
```
@keith991001

Copy link
Copy Markdown
Contributor Author

Closing as superseded by the current behavior on main, introduced in #44673. Both sync scripts now append missing template keys while preserving existing values, comments, and extra local variables. The Docker README already documents this. I verified both scripts with a sample .env containing an extra local override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: medium ghfind author score; see https://ghfind.com size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor/Chore] Correct docker/README.md on what dify-env-sync preserves

1 participant