From ca11ac0e8917d6c2a4aaba7483454799c502cc58 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 30 Jul 2025 11:44:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(project)=20change=20env.d=20system?= =?UTF-8?q?=20by=20using=20local=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We had lot of problems with the previous env.d system. Users were often confused by the need to change the env.d files manually, leading to issues when using the project locally. This commit introduces a new system that uses .env.local files, which are automatically created and can be modified by users without affecting the original env.d files. This should simplify the development process and reduce confusion by removing the need to manually edit env.d files. --- .gitignore | 3 +- Makefile | 28 ++++++------------- compose.yaml | 7 +++++ env.d/development/{common.dist => common} | 0 env.d/development/{crowdin.dist => crowdin} | 0 .../{kc_postgresql.dist => kc_postgresql} | 0 .../{postgresql.dist => postgresql} | 0 7 files changed, 16 insertions(+), 22 deletions(-) rename env.d/development/{common.dist => common} (100%) rename env.d/development/{crowdin.dist => crowdin} (100%) rename env.d/development/{kc_postgresql.dist => kc_postgresql} (100%) rename env.d/development/{postgresql.dist => postgresql} (100%) diff --git a/.gitignore b/.gitignore index 269e6f02..b959621c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,8 +40,7 @@ venv/ ENV/ env.bak/ venv.bak/ -env.d/development/* -!env.d/development/*.dist +env.d/development/*.local env.d/terraform # npm diff --git a/Makefile b/Makefile index bc867a68..4b05b126 100644 --- a/Makefile +++ b/Makefile @@ -66,19 +66,19 @@ data/static: # -- Project -create-env-files: ## Copy the dist env files to env files -create-env-files: \ - env.d/development/common \ - env.d/development/crowdin \ - env.d/development/postgresql \ - env.d/development/kc_postgresql -.PHONY: create-env-files +create-env-local-files: ## create env.local files in env.d/development +create-env-local-files: + @touch env.d/development/crowdin.local + @touch env.d/development/common.local + @touch env.d/development/postgresql.local + @touch env.d/development/kc_postgresql.local +.PHONY: create-env-local-files bootstrap: ## Prepare Docker images for the project bootstrap: \ data/media \ data/static \ - create-env-files \ + create-env-local-files \ build \ migrate \ back-i18n-compile \ @@ -212,20 +212,8 @@ resetdb: ## flush database and create a superuser "admin" @${MAKE} superuser .PHONY: resetdb -env.d/development/common: - cp -n env.d/development/common.dist env.d/development/common - -env.d/development/postgresql: - cp -n env.d/development/postgresql.dist env.d/development/postgresql - -env.d/development/kc_postgresql: - cp -n env.d/development/kc_postgresql.dist env.d/development/kc_postgresql - # -- Internationalization -env.d/development/crowdin: - cp -n env.d/development/crowdin.dist env.d/development/crowdin - crowdin-download: ## Download translated message from crowdin @$(COMPOSE_RUN_CROWDIN) download -c crowdin/config.yml .PHONY: crowdin-download diff --git a/compose.yaml b/compose.yaml index eed37fae..032ecada 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,6 +12,7 @@ services: retries: 300 env_file: - env.d/development/postgresql + - env.d/development/postgresql.local redis: image: redis:5 @@ -68,7 +69,9 @@ services: - DJANGO_CONFIGURATION=Development env_file: - env.d/development/common + - env.d/development/common.local - env.d/development/postgresql + - env.d/development/postgresql.local ports: - "8071:8000" volumes: @@ -95,7 +98,9 @@ services: - DJANGO_CONFIGURATION=Development env_file: - env.d/development/common + - env.d/development/common.local - env.d/development/postgresql + - env.d/development/postgresql.local volumes: - ./src/backend:/app - ./data/static:/data/static @@ -133,6 +138,7 @@ services: - ".:/app" env_file: - env.d/development/crowdin + - env.d/development/crowdin.local user: "${DOCKER_USER:-1000}" working_dir: /app @@ -155,6 +161,7 @@ services: - "6433:5432" env_file: - env.d/development/kc_postgresql + - env.d/development/kc_postgresql.local keycloak: image: quay.io/keycloak/keycloak:26.3.2 diff --git a/env.d/development/common.dist b/env.d/development/common similarity index 100% rename from env.d/development/common.dist rename to env.d/development/common diff --git a/env.d/development/crowdin.dist b/env.d/development/crowdin similarity index 100% rename from env.d/development/crowdin.dist rename to env.d/development/crowdin diff --git a/env.d/development/kc_postgresql.dist b/env.d/development/kc_postgresql similarity index 100% rename from env.d/development/kc_postgresql.dist rename to env.d/development/kc_postgresql diff --git a/env.d/development/postgresql.dist b/env.d/development/postgresql similarity index 100% rename from env.d/development/postgresql.dist rename to env.d/development/postgresql