♻️ Simplify Copier environment configuration (#2416)

## AI Disclaimer

Using Codex with gpt-5.6-sol. Reviewed manually.
This commit is contained in:
Sebastián Ramírez
2026-08-10 17:56:33 +02:00
committed by GitHub
parent 0625bcc8b0
commit 2c7e51505e
4 changed files with 21 additions and 28 deletions
+11
View File
@@ -9,9 +9,20 @@ answers_path = Path(__file__).parent / ".copier-answers.yml"
answers = json.loads(answers_path.read_text())
env_path = root_path / ".env"
env_content = env_path.read_text()
# Keep deployment provider settings from replacing local development defaults.
env_answer_keys = {
"emails_from_email",
"first_superuser",
"first_superuser_password",
"postgres_password",
"project_name",
"secret_key",
}
lines = []
for line in env_content.splitlines():
for key, value in answers.items():
if key not in env_answer_keys:
continue
upper_key = key.upper()
if line.startswith(f"{upper_key}="):
if " " in value: