From 59a166ddf6e0834fee0ec97813d00b2a92c26789 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 --- docker-compose.yml | 21 ++++++++++--------- spiffworkflow-backend/bin/deploy | 4 ++-- spiffworkflow-backend/docker-compose.yml | 2 +- .../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 ++---- .../scripts/get_frontend_url.py | 2 +- 9 files changed, 23 insertions(+), 24 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e19ec4a2..95b87b39 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,9 @@ services: condition: service_healthy environment: APPLICATION_ROOT: "/" - PORT0: "${SPIFF_FRONTEND_PORT:-8001}" + PORT0: "${SPIFFWORKFLOW_FRONTEND_PORT:-8001}" ports: - - "${SPIFF_FRONTEND_PORT:-8001}:${SPIFF_FRONTEND_PORT:-8001}/tcp" + - "${SPIFFWORKFLOW_FRONTEND_PORT:-8001}:${SPIFFWORKFLOW_FRONTEND_PORT:-8001}/tcp" spiffworkflow-backend: container_name: spiffworkflow-backend @@ -22,20 +22,21 @@ services: SPIFFWORKFLOW_BACKEND_ENV: "local_development" FLASK_DEBUG: "0" FLASK_SESSION_SECRET_KEY: "${FLASK_SESSION_SECRET_KEY:-super_secret_key}" - SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL: "http://localhost:${SPIFF_BACKEND_PORT:-8000}/openid" - SPIFFWORKFLOW_FRONTEND_URL: "http://localhost:${SPIFF_FRONTEND_PORT:-8001}" # WARNING: Frontend is a static site which assumes frontend port - 1 on localhost. SPIFFWORKFLOW_BACKEND_URL: "http://localhost:${SPIFF_BACKEND_PORT:-8000}" - SPIFFWORKFLOW_BACKEND_PORT: "${SPIFF_BACKEND_PORT:-8000}" - SPIFFWORKFLOW_BACKEND_UPGRADE_DB: "true" - SPIFFWORKFLOW_BACKEND_DATABASE_URI: "mysql+mysqlconnector://root:${SPIFF_MYSQL_PASS:-my-secret-pw}@spiffworkflow-db:${SPIFF_MYSQL_PORT:-8003}/spiffworkflow_backend_development" + SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR: "/app/process_models" + SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL: "http://spiffworkflow-connector:8004" + SPIFFWORKFLOW_BACKEND_DATABASE_URI: "mysql+mysqlconnector://root:${SPIFF_MYSQL_PASS:-my-secret-pw}@spiffworkflow-db:${SPIFF_MYSQL_PORT:-8003}/spiffworkflow_backend_development" SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA: "false" - SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME: "example.yml" - SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER: "true" SPIFFWORKFLOW_BACKEND_OPEN_ID_CLIENT_ID: "spiffworkflow-backend" SPIFFWORKFLOW_BACKEND_OPEN_ID_CLIENT_SECRET_KEY: "my_open_id_secret_key" - SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL: "http://spiffworkflow-connector:8004" + SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL: "http://localhost:${SPIFF_BACKEND_PORT:-8000}/openid" + SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME: "example.yml" + SPIFFWORKFLOW_BACKEND_PORT: "${SPIFF_BACKEND_PORT:-8000}" + SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER: "true" + SPIFFWORKFLOW_BACKEND_UPGRADE_DB: "true" + SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND: "http://localhost:${SPIFFWORKFLOW_FRONTEND_PORT:-8001}" ports: - "${SPIFF_BACKEND_PORT:-8000}:${SPIFF_BACKEND_PORT:-8000}/tcp" volumes: diff --git a/spiffworkflow-backend/bin/deploy b/spiffworkflow-backend/bin/deploy index 65aa3c2f..ebfd9a55 100755 --- a/spiffworkflow-backend/bin/deploy +++ b/spiffworkflow-backend/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/spiffworkflow-backend/docker-compose.yml b/spiffworkflow-backend/docker-compose.yml index 43cfd960..8fe55281 100644 --- a/spiffworkflow-backend/docker-compose.yml +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py index 6a3816c6..4aeecd37 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/config/qa2.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/qa2.py index 310897a1..f81d8864 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/qa2.py +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py index 937d17af..f75b5f06 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/routes/service_tasks_controller.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/service_tasks_controller.py index ee1bd2c3..61c8f6da 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/service_tasks_controller.py +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py index 6e7ac7e1..7b9a268a 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_frontend_url.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_frontend_url.py index 1dee0c49..503b9584 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_frontend_url.py +++ b/spiffworkflow-backend/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"]