From a886f701b2bc9af1839666a7bae37e556b4c7f8d Mon Sep 17 00:00:00 2001 From: Andrew <84722778+andrew-jameson@users.noreply.github.com> Date: Thu, 2 Nov 2023 09:44:43 -0400 Subject: [PATCH] Update cloudgov.py (#2730) * Update cloudgov.py * hijack develop workflow to test deployments. * syntax typo. * I can't believe this typo. * linting whitespace * removed extra space * Adding in staging jwt_key due to recent deployment failure. * Removing self-reference branch filter for mergability --------- Co-authored-by: andrew-jameson Co-authored-by: George Hudson --- scripts/deploy-backend.sh | 6 +++++- tdrs-backend/tdpservice/settings/cloudgov.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/deploy-backend.sh b/scripts/deploy-backend.sh index f50152891..7fb1fb657 100755 --- a/scripts/deploy-backend.sh +++ b/scripts/deploy-backend.sh @@ -51,6 +51,8 @@ set_cf_envs() "FRONTEND_BASE_URL" "LOGGING_LEVEL" "REDIS_URI" + "JWT_KEY" + "STAGING_JWT_KEY" ) echo "Setting environment variables for $CGAPPNAME_BACKEND" @@ -62,6 +64,8 @@ set_cf_envs() cf_cmd="cf unset-env $CGAPPNAME_BACKEND $var_name ${!var_name}" $cf_cmd continue + elif [[ ("$var_name" =~ "STAGING_*") && ("$CF_SPACE" = "tanf-staging") ]]; then + var_name=$(echo "$var_name" | sed -e 's@STAGING_@@g') fi cf_cmd="cf set-env $CGAPPNAME_BACKEND $var_name ${!var_name}" @@ -128,7 +132,7 @@ update_backend() bind_backend_to_services() { echo "Binding services to app: $CGAPPNAME_BACKEND" - if [ "$CFAPPNAME_BACKEND" = "tdp-backend-develop" ]; then + if [ "$CGAPPNAME_BACKEND" = "tdp-backend-develop" ]; then # TODO: this is technical debt, we should either make staging mimic tanf-dev # or make unique services for all apps but we have a services limit # Introducing technical debt for release 3.0.0 specifically. diff --git a/tdrs-backend/tdpservice/settings/cloudgov.py b/tdrs-backend/tdpservice/settings/cloudgov.py index 6f7c7342b..b7def9383 100644 --- a/tdrs-backend/tdpservice/settings/cloudgov.py +++ b/tdrs-backend/tdpservice/settings/cloudgov.py @@ -70,7 +70,11 @@ class CloudGov(Common): # env_based_db_name = f'tdp_db_{cloudgov_space_suffix}_{cloudgov_name}' - db_name = database_creds['db_name'] if (cloudgov_space_suffix in ["prod", "staging"]) else env_based_db_name + logger.debug("css: " + cloudgov_space_suffix) + if (cloudgov_space_suffix in ["prod", "staging"]): + db_name = database_creds['db_name'] + else: + db_name = env_based_db_name DATABASES = { 'default': {