From 9d8ee5bc8f5c35a6645aba4999a96a4fa7a2f171 Mon Sep 17 00:00:00 2001 From: vincent porte Date: Thu, 19 Dec 2024 17:16:15 +0100 Subject: [PATCH 1/4] set ENVIRONMENT var in review app --- .github/workflows/review-app-creation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/review-app-creation.yml b/.github/workflows/review-app-creation.yml index c50a6a40..5afef1bf 100644 --- a/.github/workflows/review-app-creation.yml +++ b/.github/workflows/review-app-creation.yml @@ -69,6 +69,7 @@ jobs: run: | $CLEVER_CLI link $REVIEW_APP_NAME --org $REVIEW_APPS_ORGANIZATION_NAME $CLEVER_CLI env set COMMU_FQDN "${{ env.DEPLOY_URL }}" + $CLEVER_CLI env set ENVIRONMENT "REVIEW-APP" $CLEVER_CLI service link-addon $S3_ADDON $CLEVER_CLI service link-addon $CONFIGURATION_ADDON From d80174c0c0994648c6955ba2b7b3bd11cf08ae6e Mon Sep 17 00:00:00 2001 From: vincent porte Date: Thu, 19 Dec 2024 17:16:41 +0100 Subject: [PATCH 2/4] =?UTF-8?q?set=20dynamic=20ENVIRONMENT=C2=A0collection?= =?UTF-8?q?=20in=20base.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/settings/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/settings/base.py b/config/settings/base.py index 74c7c355..ea5f1e97 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -19,7 +19,7 @@ SECRET_KEY = os.getenv("DJANGO_SECRET_KEY") DEBUG = os.getenv("DJANGO_DEBUG", "False") == "True" -ENVIRONMENT = Environment.PROD +ENVIRONMENT = os.getenv("ENVIRONMENT", Environment.PROD) PARKING_PAGE = os.getenv("PARKING_PAGE", "False") == "True" From 10cf3d186152be6e045a7ae0270a33e2a7ba6425 Mon Sep 17 00:00:00 2001 From: vincent porte Date: Thu, 19 Dec 2024 17:18:36 +0100 Subject: [PATCH 3/4] add script to collect env vars from repo --- clevercloud/pre_build.sh | 2 ++ clevercloud/pre_run.sh | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 clevercloud/pre_build.sh create mode 100644 clevercloud/pre_run.sh diff --git a/clevercloud/pre_build.sh b/clevercloud/pre_build.sh new file mode 100644 index 00000000..fc938999 --- /dev/null +++ b/clevercloud/pre_build.sh @@ -0,0 +1,2 @@ +git clone "$ITOU_SECRETS_HTTPS_REPO_URL" secrets-vault +sops -d secrets-vault/c1/"$ENVIRONMENT".enc.env > .env diff --git a/clevercloud/pre_run.sh b/clevercloud/pre_run.sh new file mode 100644 index 00000000..2543050e --- /dev/null +++ b/clevercloud/pre_run.sh @@ -0,0 +1,4 @@ +cd secrets-vault || exit +git pull +cd - || exit +sops -d secrets-vault/c1/"$ENVIRONMENT".enc.env > .env From 8873cb9e1f8bef567b9b929652f65a38bfc4a30e Mon Sep 17 00:00:00 2001 From: vincent porte Date: Thu, 19 Dec 2024 17:47:00 +0100 Subject: [PATCH 4/4] make pre_*.sh executable --- clevercloud/pre_build.sh | 0 clevercloud/pre_run.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 clevercloud/pre_build.sh mode change 100644 => 100755 clevercloud/pre_run.sh diff --git a/clevercloud/pre_build.sh b/clevercloud/pre_build.sh old mode 100644 new mode 100755 diff --git a/clevercloud/pre_run.sh b/clevercloud/pre_run.sh old mode 100644 new mode 100755