From 78264e755e1c80e08a97d210e297f5dcdc975165 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 23 May 2023 16:58:58 -0400 Subject: [PATCH] some updates to help support different domains w/ burnettk --- .../realm_exports/spiffworkflow-realm.json | 4 ++-- .../config/terraform_deployed_environment.py | 15 ++++++++++----- .../src/components/NavigationBar.tsx | 6 +++--- spiffworkflow-frontend/src/config.tsx | 5 +++++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/spiffworkflow-backend/keycloak/realm_exports/spiffworkflow-realm.json b/spiffworkflow-backend/keycloak/realm_exports/spiffworkflow-realm.json index 9bacd5066..753b2d7ef 100644 --- a/spiffworkflow-backend/keycloak/realm_exports/spiffworkflow-realm.json +++ b/spiffworkflow-backend/keycloak/realm_exports/spiffworkflow-realm.json @@ -3250,7 +3250,7 @@ "alwaysDisplayInConsole" : false, "clientAuthenticatorType" : "client-secret", "secret" : "JXeQExm0JhQPLumgHtIIqf52bDalHz0q", - "redirectUris" : [ "http://localhost:7000/*", "https://api.unused-for-local-dev.spiffworkflow.org/*", "https://api.replace-me-with-spiff-subdomain.spiffworkflow.org/*", "http://67.205.133.116:7000/*", "http://167.172.242.138:7000/*" ], + "redirectUris" : [ "http://localhost:7000/*", "https://api.unused-for-local-dev.spiffworkflow.org/*", "https://api.replace-me-with-spiff-domain/*", "http://67.205.133.116:7000/*", "http://167.172.242.138:7000/*" ], "webOrigins" : [ ], "notBefore" : 0, "bearerOnly" : false, @@ -3267,7 +3267,7 @@ "saml.force.post.binding" : "false", "saml.multivalued.roles" : "false", "frontchannel.logout.session.required" : "false", - "post.logout.redirect.uris" : "https://replace-me-with-spiff-subdomain.spiffworkflow.org/*##http://localhost:7001/*", + "post.logout.redirect.uris" : "https://replace-me-with-spiff-domain/*##http://localhost:7001/*", "oauth2.device.authorization.grant.enabled" : "false", "backchannel.logout.revoke.offline.tokens" : "false", "saml.server.signature.keyinfo.ext" : "false", 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 985047b7c..1dfbcdf62 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py @@ -28,12 +28,17 @@ SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL = environ.get( ), ) -SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND = ( - f"https://{environment_identifier_for_this_config_file_only}.spiffworkflow.org" +SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND = environ.get( + 'SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND', + default=f"https://{environment_identifier_for_this_config_file_only}.spiffworkflow.org" ) -SPIFFWORKFLOW_BACKEND_URL = f"https://api.{environment_identifier_for_this_config_file_only}.spiffworkflow.org" -SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL = ( - f"https://connector-proxy.{environment_identifier_for_this_config_file_only}.spiffworkflow.org" +SPIFFWORKFLOW_BACKEND_URL = environ.get( + 'SPIFFWORKFLOW_BACKEND_URL', + default=f"https://api.{environment_identifier_for_this_config_file_only}.spiffworkflow.org" +) +SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL = environ.get( + 'SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL', + default=f"https://connector-proxy.{environment_identifier_for_this_config_file_only}.spiffworkflow.org" ) SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get( "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL", diff --git a/spiffworkflow-frontend/src/components/NavigationBar.tsx b/spiffworkflow-frontend/src/components/NavigationBar.tsx index b9301d9fc..452a1ac23 100644 --- a/spiffworkflow-frontend/src/components/NavigationBar.tsx +++ b/spiffworkflow-frontend/src/components/NavigationBar.tsx @@ -29,7 +29,7 @@ import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { PermissionsToCheck } from '../interfaces'; import { usePermissionFetcher } from '../hooks/PermissionService'; import { UnauthenticatedError } from '../services/HttpService'; -import { SPIFF_ENVIRONMENT } from '../config'; +import { DOCUMENTATION_URL, SPIFF_ENVIRONMENT } from '../config'; import appVersionInfo from '../helpers/appVersionInfo'; // for ref: https://react-bootstrap.github.io/components/navbar/ @@ -61,8 +61,8 @@ export default function NavigationBar() { // default to readthedocs and let someone specify an environment variable to override: // let documentationUrl = 'https://spiffworkflow.readthedocs.io'; - if ('DOCUMENTATION_URL' in window.spiffworkflowFrontendJsenv) { - documentationUrl = window.spiffworkflowFrontendJsenv.DOCUMENTATION_URL; + if (DOCUMENTATION_URL) { + documentationUrl = DOCUMENTATION_URL; } const versionInfo = appVersionInfo(); diff --git a/spiffworkflow-frontend/src/config.tsx b/spiffworkflow-frontend/src/config.tsx index 78565d2e1..8edba04f4 100644 --- a/spiffworkflow-frontend/src/config.tsx +++ b/spiffworkflow-frontend/src/config.tsx @@ -13,6 +13,7 @@ declare global { let spiffEnvironment = ''; let appRoutingStrategy = 'subdomain_based'; let backendBaseUrl = null; +let documentationUrl = null; if ('spiffworkflowFrontendJsenv' in window) { if ('APP_ROUTING_STRATEGY' in window.spiffworkflowFrontendJsenv) { appRoutingStrategy = window.spiffworkflowFrontendJsenv.APP_ROUTING_STRATEGY; @@ -23,6 +24,9 @@ if ('spiffworkflowFrontendJsenv' in window) { if ('BACKEND_BASE_URL' in window.spiffworkflowFrontendJsenv) { backendBaseUrl = window.spiffworkflowFrontendJsenv.BACKEND_BASE_URL; } + if ('DOCUMENTATION_URL' in window.spiffworkflowFrontendJsenv) { + documentationUrl = window.spiffworkflowFrontendJsenv.DOCUMENTATION_URL; + } } if (!backendBaseUrl) { @@ -66,6 +70,7 @@ if (!backendBaseUrl.endsWith('/v1.0')) { } export const BACKEND_BASE_URL = backendBaseUrl; +export const DOCUMENTATION_URL = documentationUrl; export const PROCESS_STATUSES = [ 'not_started',