From 38775b1e1234b95bab4ac68dc79d47551c0be903 Mon Sep 17 00:00:00 2001 From: John DeAngelis Date: Tue, 8 Oct 2024 13:12:56 -0400 Subject: [PATCH] add HHSAMS config to vite env files Signed-off-by: John DeAngelis --- frontend/Dockerfile.azure | 3 ++- frontend/src/helpers/backend.js | 10 +++++++--- frontend/vite-env/env.dev.local | 4 +++- frontend/vite-env/env.local | 3 +++ frontend/vite-env/env.production.local | 4 +++- frontend/vite-env/env.stg.local | 4 +++- 6 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 frontend/vite-env/env.local diff --git a/frontend/Dockerfile.azure b/frontend/Dockerfile.azure index d17df786e6..949afcee76 100644 --- a/frontend/Dockerfile.azure +++ b/frontend/Dockerfile.azure @@ -17,7 +17,8 @@ COPY . . # Build the application ARG MODE ARG VITE_BACKEND_DOMAIN -COPY vite-env/env.${MODE}.local .env +COPY vite-env/env.local . +COPY vite-env/env.${MODE}.local . RUN VITE_BACKEND_DOMAIN=${VITE_BACKEND_DOMAIN} NODE_ENV=${MODE} bun run build --mode ${MODE} # ---- Release Stage ---- diff --git a/frontend/src/helpers/backend.js b/frontend/src/helpers/backend.js index 406f4786fa..93364e7f83 100644 --- a/frontend/src/helpers/backend.js +++ b/frontend/src/helpers/backend.js @@ -30,13 +30,17 @@ export const callBackend = async (urlPath, action, requestBody, queryParams, use export const authConfig = { hhsams: { - auth_endpoint: "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/auth", - client_id: "44fe2c7a-e9c5-43ec-87e9-3de78d2d3a11", + auth_endpoint: + import.meta.env.VITE_HHSAMS_AUTH_ENDPOINT || + "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/auth", + client_id: import.meta.env.VITE_HHSAMS_CLIENT_ID || "44fe2c7a-e9c5-43ec-87e9-3de78d2d3a11", response_type: "code", scope: "openid profile email", redirect_uri: `${window.location.origin}/login`, acr_values: 1, - logout_endpoint: "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/logout" + logout_endpoint: + import.meta.env.VITE_HHSAMS_LOGOUT_ENDPOINT || + "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/logout" }, logingov: { auth_endpoint: "https://idp.int.identitysandbox.gov/openid_connect/authorize", diff --git a/frontend/vite-env/env.dev.local b/frontend/vite-env/env.dev.local index 355dc4649a..fd8fd39e1e 100644 --- a/frontend/vite-env/env.dev.local +++ b/frontend/vite-env/env.dev.local @@ -1 +1,3 @@ -VITE_ENV_VAR_EXAMPLE=dev-example +VITE_HHSAMS_CLIENT_ID=44fe2c7a-e9c5-43ec-87e9-3de78d2d3a11 +VITE_HHSAMS_AUTH_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/auth +VITE_HHSAMS_LOGOUT_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/logout diff --git a/frontend/vite-env/env.local b/frontend/vite-env/env.local new file mode 100644 index 0000000000..fd8fd39e1e --- /dev/null +++ b/frontend/vite-env/env.local @@ -0,0 +1,3 @@ +VITE_HHSAMS_CLIENT_ID=44fe2c7a-e9c5-43ec-87e9-3de78d2d3a11 +VITE_HHSAMS_AUTH_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/auth +VITE_HHSAMS_LOGOUT_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/logout diff --git a/frontend/vite-env/env.production.local b/frontend/vite-env/env.production.local index 992309ec30..fd8fd39e1e 100644 --- a/frontend/vite-env/env.production.local +++ b/frontend/vite-env/env.production.local @@ -1 +1,3 @@ -VITE_ENV_VAR_EXAMPLE=prod-example +VITE_HHSAMS_CLIENT_ID=44fe2c7a-e9c5-43ec-87e9-3de78d2d3a11 +VITE_HHSAMS_AUTH_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/auth +VITE_HHSAMS_LOGOUT_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/logout diff --git a/frontend/vite-env/env.stg.local b/frontend/vite-env/env.stg.local index 77b372cd99..fd8fd39e1e 100644 --- a/frontend/vite-env/env.stg.local +++ b/frontend/vite-env/env.stg.local @@ -1 +1,3 @@ -VITE_ENV_VAR_EXAMPLE=stg-example +VITE_HHSAMS_CLIENT_ID=44fe2c7a-e9c5-43ec-87e9-3de78d2d3a11 +VITE_HHSAMS_AUTH_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/auth +VITE_HHSAMS_LOGOUT_ENDPOINT=https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/logout