From 07065dfa7e7cd13a98e4298cb000dc497dba9208 Mon Sep 17 00:00:00 2001 From: William Welling <8352733+wwelling@users.noreply.github.com> Date: Wed, 11 Jan 2023 08:40:18 -0600 Subject: [PATCH] Afford environment configuration of FQDN UI URL (#102) --- README.md | 3 ++- server.ts | 2 ++ src/app/app.config.ts | 1 + src/app/core/store/index.ts | 2 +- src/assets/appConfig.json | 3 ++- src/test.config.ts | 1 + 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1b9067db7..860814a66 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,10 @@ In addition to having [Docker](https://docs.docker.com/) installed, a running [S -e BASE_HREF=/ \ -e SERVICE_URL="http://localhost:9000" \ -e EMBED_URL="http://localhost:4201" \ + -e UI_URL="http://localhost:4200" \ -e VIVO_URL="http://localhost:8080/vivo" \ -e VIVO_EDITOR_URL="http://localhost:8080/vivo_editor" \ - -e COLLECT_SEARCH_STATS=true \ + -e COLLECT_SEARCH_STATS=false \ scholars/angular ``` diff --git a/server.ts b/server.ts index 4e9529971..66a83f38b 100644 --- a/server.ts +++ b/server.ts @@ -80,6 +80,7 @@ function run() { const SERVICE_URL = process.env.SERVICE_URL || 'http://localhost:9000'; const EMBED_URL = process.env.EMBED_URL || 'http://localhost:4201'; + const UI_URL = process.env.UI_URL || 'http://localhost:4200'; const VIVO_URL = process.env.VIVO_URL || 'http://localhost:8080/vivo'; const VIVO_EDITOR_URL = process.env.VIVO_EDITOR_URL || 'http://localhost:8080/vivo_editor'; @@ -91,6 +92,7 @@ function run() { baseHref: BASE_HREF, serviceUrl: SERVICE_URL, embedUrl: EMBED_URL, + uiUrl: UI_URL, vivoUrl: VIVO_URL, vivoEditorUrl: VIVO_EDITOR_URL, collectSearchStats: COLLECT_SEARCH_STATS diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 59a32ede7..3bf78a41b 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -6,6 +6,7 @@ interface AppConfig { baseHref: string; serviceUrl: string; embedUrl: string; + uiUrl: string; vivoUrl: string; vivoEditorUrl: string; collectSearchStats: boolean; diff --git a/src/app/core/store/index.ts b/src/app/core/store/index.ts index 4a60a7c3c..9f5a7fecd 100644 --- a/src/app/core/store/index.ts +++ b/src/app/core/store/index.ts @@ -46,7 +46,7 @@ export interface AppState { export const reducers = (appConfig: AppConfig): ActionReducerMap => { const additionalContext = { - uiUrl: `//${appConfig.host}${appConfig.port !== 80 && appConfig.port !== 443 ? ':' + appConfig.port : ''}${appConfig.baseHref}`, + uiUrl: appConfig.uiUrl, vivoUrl: appConfig.vivoUrl, serviceUrl: appConfig.serviceUrl, }; diff --git a/src/assets/appConfig.json b/src/assets/appConfig.json index cf0c67913..50ae923f8 100644 --- a/src/assets/appConfig.json +++ b/src/assets/appConfig.json @@ -4,6 +4,7 @@ "baseHref": "/", "serviceUrl": "http://localhost:9000", "embedUrl": "http://localhost:4201", + "uiUrl": "http://localhost:4200", "vivoUrl": "http://localhost:8080/vivo", "vivoEditorUrl": "http://localhost:8080/vivo_editor" -} \ No newline at end of file +} diff --git a/src/test.config.ts b/src/test.config.ts index bb9ca3d23..05663242a 100644 --- a/src/test.config.ts +++ b/src/test.config.ts @@ -6,6 +6,7 @@ export const testAppConfig: AppConfig = { baseHref: '/', serviceUrl: 'http://localhost:9000', embedUrl: 'http://localhost:4201', + uiUrl: 'http://localhost:4200', vivoUrl: 'http://localhost:8080/vivo', vivoEditorUrl: 'http://localhost:8080/vivo_editor', collectSearchStats: false