From 356ce4f1e029ac1c799c29776c94e2ec6ce0904a Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Tue, 27 Jun 2023 01:53:59 +0300 Subject: [PATCH] RED-6686 version fix --- apps/red-ui/src/assets/config/config.json | 4 ++-- .../red-ui/src/assets/config/version.json | 0 apps/red-ui/src/main.ts | 10 ++++++---- docker/red-ui/Dockerfile | 3 +-- version.properties | 1 - 5 files changed, 9 insertions(+), 9 deletions(-) rename version.json => apps/red-ui/src/assets/config/version.json (100%) delete mode 100644 version.properties diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 5e5347695..311b38e1a 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,7 +1,7 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://dev-01.iqser.cloud", + "API_URL": "https://dev-02.iqser.cloud", "APP_NAME": "RedactManager", "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", @@ -11,7 +11,7 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://dev-01.iqser.cloud/auth", + "OAUTH_URL": "https://dev-02.iqser.cloud/auth", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview", diff --git a/version.json b/apps/red-ui/src/assets/config/version.json similarity index 100% rename from version.json rename to apps/red-ui/src/assets/config/version.json diff --git a/apps/red-ui/src/main.ts b/apps/red-ui/src/main.ts index 159d77fb8..3c591da0a 100644 --- a/apps/red-ui/src/main.ts +++ b/apps/red-ui/src/main.ts @@ -10,9 +10,8 @@ if (environment.production) { } // https://github.com/angular/angular/issues/11195#issuecomment-248020928 -async function bootstrap(appConfig: AppConfig) { - const packageJson = await import('version.json'); - const config = { ...appConfig, FRONTEND_APP_VERSION: packageJson.FRONTEND_APP_VERSION }; +async function bootstrap(appConfig: AppConfig, version: { FRONTEND_APP_VERSION: string }) { + const config = { ...appConfig, FRONTEND_APP_VERSION: version.FRONTEND_APP_VERSION }; console.log('Started with local config: ', config); const appModule = appModuleFactory(config); @@ -28,5 +27,8 @@ async function bootstrap(appConfig: AppConfig) { } const configPromise = fetch('/ui/assets/config/config.json').then(resp => resp.json()); +const versionPromise = fetch('/ui/assets/config/version.json').then(resp => resp.json()); -configPromise.then(bootstrap).catch(console.error); +Promise.all([configPromise, versionPromise]) + .then(([appConfig, version]) => bootstrap(appConfig, version)) + .catch(console.error); diff --git a/docker/red-ui/Dockerfile b/docker/red-ui/Dockerfile index 1cd0671d1..41defc9d0 100644 --- a/docker/red-ui/Dockerfile +++ b/docker/red-ui/Dockerfile @@ -1,8 +1,6 @@ FROM node:18.12-buster as prep RUN apt-get update && apt-get install -y jq -COPY version.json version.json -RUN cat version.json COPY package.json /tmp RUN jq '{ dependencies, devDependencies, peerDependencies, scripts: (.scripts | { postinstall }) }' < /tmp/package.json > /tmp/deps.json @@ -58,6 +56,7 @@ RUN rm -rf /usr/share/nginx/html/* ## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder COPY --from=builder /ng-app/dist/apps/red-ui /usr/share/nginx/html/ui +COPY version.json /usr/share/nginx/html/ui/assets/config/version.json RUN chmod o+r -R /usr/share/nginx/html RUN chmod g+r -R /usr/share/nginx/html diff --git a/version.properties b/version.properties deleted file mode 100644 index f16b9775f..000000000 --- a/version.properties +++ /dev/null @@ -1 +0,0 @@ -APP_VERSION=4.102.0