fix(env): default DJANGO_BPP_MEDIA_ROOT=/mediaroot#7
Merged
Conversation
Without DJANGO_BPP_MEDIA_ROOT Django falls back to its built-in default
(~/bpp-media = /root/bpp-media in the container), off the `media` volume
mounted at /mediaroot in every Django container. Uploads then vanish on
container recreate and are excluded from backups (backup-cycle.sh tars
/mediaroot, not /root).
Set the var in three coordinated places so it lands in .env in every
scenario (backwards-compat contract: `git pull && make up` must work with
no manual step):
- init-configs.sh heredoc -> fresh .env (sibling of STATIC_ROOT)
- init-configs.sh ensure_env_var -> backfill on `make init-configs`
- ensure-config-files.sh -> append-only self-heal, runs on every
`make up`/`refresh`, fixes old .env
files automatically (no manual step)
Value is unquoted to satisfy the validate-env-quotes guard; self-heal is
append-only so a user override is preserved.
Refactor: shared _ensure_var helper in ensure-config-files.sh;
_ensure_secret is now a thin wrapper over it (byte-identical log output,
secret value still never written to the log).
Docs: parallel "Media" section in docs/konfiguracja/architektura.md and
an agent-steering note in CLAUDE.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DJANGO_BPP_MEDIA_ROOTbył ustawiany nigdzie, więc Django brał swój wbudowany domyślnyMEDIA_ROOT(~/bpp-media=/root/bpp-mediaw kontenerze) — poza wolumenemmediamontowanym pod/mediarootwe wszystkich kontenerach Django.Skutki:
docker compose up/recreate (są w warstwie kontenera, nie w wolumenie),backup-cycle.shtaruje/mediaroot, nie/root.Rozwiązanie
DJANGO_BPP_MEDIA_ROOT=/mediarootustawiane w trzech skoordynowanych miejscach, żeby wartość trafiła do.envw każdym scenariuszu (zgodnie z kontraktem kompatybilności wstecznej —git pull && make upmusi działać bez ręcznych kroków):init-configs.sh— heredoc nowego.env(obokSTATIC_ROOT)init-configs.sh—ensure_env_varmake init-configsensure-config-files.sh— append-only self-heal (_ensure_var)make up/refresh— bez ręcznej edycjiDodatkowo:
validate-env-quotesodrzuca cudzysłowy),_ensure_var;_ensure_secretto teraz cienki wrapper nad nim — identyczny komunikat logu, wartość sekretu nadal nigdy nie trafia do logu.Dokumentacja
docs/konfiguracja/architektura.md(równolegle doSTATIC_ROOT),CLAUDE.md.Weryfikacja
bash -n— oba skrypty OK; pre-commit (shellcheck, TruffleHog, detect-private-key) zielony.VAR=(zastąpiona), nadpisanie użytkownika (zachowane)._ensure_secretpo refaktorze: byte-identyczny log, brak wycieku wartości.mkdocs build --strictnie uruchomiony lokalnie (mkdocs niezainstalowany, PEP 668) — edycja dodała tylko prozę + jeden nagłówek do strony już w nav, bez nowych linków, więc CI (docs.yml) to pokryje.🤖 Generated with Claude Code