Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cloudgov.py #2730

Merged
merged 9 commits into from
Nov 2, 2023
6 changes: 5 additions & 1 deletion scripts/deploy-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ("$CF_SPACE" == "tanf-staging")?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially thought the same thing but saw the single = used in other comparisons so went with what was used elsewhere.

var_name=$(echo "$var_name" | sed -e 's@STAGING_@@g')
fi

cf_cmd="cf set-env $CGAPPNAME_BACKEND $var_name ${!var_name}"
Expand Down Expand Up @@ -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
andrew-jameson marked this conversation as resolved.
Show resolved Hide resolved
# 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.
Expand Down
6 changes: 5 additions & 1 deletion tdrs-backend/tdpservice/settings/cloudgov.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
raftmsohani marked this conversation as resolved.
Show resolved Hide resolved

DATABASES = {
'default': {
Expand Down
Loading