From 88fe9e669f8abefafbab4385347cb8eee8d72181 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 16 Feb 2023 10:21:02 -0500 Subject: [PATCH] more config updates w/ burnettk --- bin/deploy | 4 ++-- docker-compose.yml | 2 +- src/spiffworkflow_backend/config/default.py | 6 +++--- src/spiffworkflow_backend/config/qa2.py | 2 +- .../config/terraform_deployed_environment.py | 2 +- .../routes/service_tasks_controller.py | 2 +- src/spiffworkflow_backend/routes/user.py | 6 ++---- src/spiffworkflow_backend/scripts/get_frontend_url.py | 2 +- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/bin/deploy b/bin/deploy index 65aa3c2f..ebfd9a55 100755 --- a/bin/deploy +++ b/bin/deploy @@ -31,8 +31,8 @@ if [[ -z "${SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE:-}" ]]; then export SPIFFWORKFLOW_BACKEND_DOCKER_COMPOSE_PROFILE=run fi -if [[ -z "${SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL:-}" ]]; then - export SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL='http://167.172.242.138:7001' +if [[ -z "${SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND:-}" ]]; then + export SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND='http://167.172.242.138:7001' fi if [[ -z "${SPIFFWORKFLOW_BACKEND_URL:-}" ]]; then diff --git a/docker-compose.yml b/docker-compose.yml index 43cfd960..8fe55281 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,7 +61,7 @@ services: - SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME=${SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME:-acceptance_tests.yml} - SPIFFWORKFLOW_BACKEND_PORT=7000 - SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER=true - - SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL=${SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL:-http://localhost:7001} + - SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND=${SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND:-http://localhost:7001} - SPIFFWORKFLOW_BACKEND_UPGRADE_DB=true - SPIFFWORKFLOW_BACKEND_URL=${SPIFFWORKFLOW_BACKEND_URL:-http://localhost:7000} ports: diff --git a/src/spiffworkflow_backend/config/default.py b/src/spiffworkflow_backend/config/default.py index 6a3816c6..4aeecd37 100644 --- a/src/spiffworkflow_backend/config/default.py +++ b/src/spiffworkflow_backend/config/default.py @@ -15,8 +15,8 @@ SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER = ( environ.get("SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER", default="false") == "true" ) -SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL = environ.get( - "SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL", default="http://localhost:7001" +SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND = environ.get( + "SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND", default="http://localhost:7001" ) SPIFFWORKFLOW_BACKEND_URL = environ.get( "SPIFFWORKFLOW_BACKEND_URL", default="http://localhost:7000" @@ -128,7 +128,7 @@ SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP = environ.get( "SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP", default="everybody" ) -# this is only used in CI +# this is only used in CI. use SPIFFWORKFLOW_BACKEND_DATABASE_URI instead for real configuration SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD = environ.get( "SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD", default=None ) diff --git a/src/spiffworkflow_backend/config/qa2.py b/src/spiffworkflow_backend/config/qa2.py index 310897a1..f81d8864 100644 --- a/src/spiffworkflow_backend/config/qa2.py +++ b/src/spiffworkflow_backend/config/qa2.py @@ -4,7 +4,7 @@ from os import environ SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get( "SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME", default="qa1.yml" ) -SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL = "https://qa2.spiffworkflow.org" +SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND = "https://qa2.spiffworkflow.org" SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL = ( "https://qa2.spiffworkflow.org/keycloak/realms/spiffworkflow" ) diff --git a/src/spiffworkflow_backend/config/terraform_deployed_environment.py b/src/spiffworkflow_backend/config/terraform_deployed_environment.py index 937d17af..f75b5f06 100644 --- a/src/spiffworkflow_backend/config/terraform_deployed_environment.py +++ b/src/spiffworkflow_backend/config/terraform_deployed_environment.py @@ -23,7 +23,7 @@ SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL = ( f"https://keycloak.{environment_identifier_for_this_config_file_only}" ".spiffworkflow.org/realms/spiffworkflow" ) -SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL = ( +SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND = ( f"https://{environment_identifier_for_this_config_file_only}.spiffworkflow.org" ) SPIFFWORKFLOW_BACKEND_URL = ( diff --git a/src/spiffworkflow_backend/routes/service_tasks_controller.py b/src/spiffworkflow_backend/routes/service_tasks_controller.py index ee1bd2c3..61c8f6da 100644 --- a/src/spiffworkflow_backend/routes/service_tasks_controller.py +++ b/src/spiffworkflow_backend/routes/service_tasks_controller.py @@ -47,5 +47,5 @@ def authentication_callback( f"{service}/{auth_method}", response, g.user.id, create_if_not_exists=True ) return redirect( - f"{current_app.config['SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL']}/admin/configuration" + f"{current_app.config['SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND']}/admin/configuration" ) diff --git a/src/spiffworkflow_backend/routes/user.py b/src/spiffworkflow_backend/routes/user.py index 6e7ac7e1..7b9a268a 100644 --- a/src/spiffworkflow_backend/routes/user.py +++ b/src/spiffworkflow_backend/routes/user.py @@ -188,7 +188,7 @@ def set_new_access_token_in_cookie( domain_for_frontend_cookie: Optional[str] = re.sub( r"^https?:\/\/", "", - current_app.config["SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL"], + current_app.config["SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND"], ) if domain_for_frontend_cookie and domain_for_frontend_cookie.startswith( "localhost" @@ -353,9 +353,7 @@ def logout(id_token: str, redirect_url: Optional[str]) -> Response: def logout_return() -> Response: """Logout_return.""" - frontend_url = str( - current_app.config["SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL"] - ) + frontend_url = str(current_app.config["SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND"]) return redirect(f"{frontend_url}/") diff --git a/src/spiffworkflow_backend/scripts/get_frontend_url.py b/src/spiffworkflow_backend/scripts/get_frontend_url.py index 1dee0c49..503b9584 100644 --- a/src/spiffworkflow_backend/scripts/get_frontend_url.py +++ b/src/spiffworkflow_backend/scripts/get_frontend_url.py @@ -28,4 +28,4 @@ class GetFrontendUrl(Script): **kwargs: Any ) -> Any: """Run.""" - return current_app.config["SPIFFWORKFLOW_BACKEND_SPIFFWORKFLOW_FRONTEND_URL"] + return current_app.config["SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND"]