From 78e8a3e703e825b89c3ba9e8fc71e59f46ab1a9f Mon Sep 17 00:00:00 2001 From: edraft Date: Fri, 3 Jan 2025 14:51:08 +0100 Subject: [PATCH] Load config by env --- web/.gitignore | 1 + web/src/app/service/settings.service.ts | 3 ++- web/src/assets/{ => config}/config.json | 8 ++++---- web/src/environments/environment.development.ts | 1 + web/src/environments/environment.local.ts | 1 + web/src/environments/environment.production.ts | 1 + web/src/environments/environment.staging.ts | 1 + web/src/environments/environment.ts | 1 + 8 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 web/.gitignore rename web/src/assets/{ => config}/config.json (74%) diff --git a/web/.gitignore b/web/.gitignore new file mode 100644 index 0000000..56324c9 --- /dev/null +++ b/web/.gitignore @@ -0,0 +1 @@ +config.*.json \ No newline at end of file diff --git a/web/src/app/service/settings.service.ts b/web/src/app/service/settings.service.ts index b66a8ec..de948e3 100644 --- a/web/src/app/service/settings.service.ts +++ b/web/src/app/service/settings.service.ts @@ -3,6 +3,7 @@ import { Injectable } from "@angular/core"; import { throwError } from "rxjs"; import { catchError } from "rxjs/operators"; import { AppSettings } from "src/app/model/config/app-settings"; +import { environment } from "src/environments/environment"; @Injectable({ providedIn: "root", @@ -15,7 +16,7 @@ export class SettingsService { loadSettings(): Promise { return new Promise((resolve, reject) => { this.http - .get("/assets/config.json") + .get(`/assets/config/${environment.config}`) .pipe( catchError((error) => { reject(error); diff --git a/web/src/assets/config.json b/web/src/assets/config/config.json similarity index 74% rename from web/src/assets/config.json rename to web/src/assets/config/config.json index e067899..5a11e79 100644 --- a/web/src/assets/config.json +++ b/web/src/assets/config/config.json @@ -9,12 +9,12 @@ } ], "api": { - "url": "http://localhost:5000/api" + "url": "" }, "keycloak": { - "url": "https://keycloak.maxlan.de", - "realm": "develop", - "clientId": "lan-maestro-client-local" + "url": "", + "realm": "", + "clientId": "" }, "loadingScreen": { "background": "https://www.sh-edraft.de/wp-content/uploads/2020/03/IMG_20170731_213039-scaled.jpg", diff --git a/web/src/environments/environment.development.ts b/web/src/environments/environment.development.ts index cde8b82..043e6c2 100644 --- a/web/src/environments/environment.development.ts +++ b/web/src/environments/environment.development.ts @@ -4,4 +4,5 @@ export const environment = { production: false, + config: "config.json", }; diff --git a/web/src/environments/environment.local.ts b/web/src/environments/environment.local.ts index cde8b82..21adec2 100644 --- a/web/src/environments/environment.local.ts +++ b/web/src/environments/environment.local.ts @@ -4,4 +4,5 @@ export const environment = { production: false, + config: "config.local.json", }; diff --git a/web/src/environments/environment.production.ts b/web/src/environments/environment.production.ts index cde8b82..043e6c2 100644 --- a/web/src/environments/environment.production.ts +++ b/web/src/environments/environment.production.ts @@ -4,4 +4,5 @@ export const environment = { production: false, + config: "config.json", }; diff --git a/web/src/environments/environment.staging.ts b/web/src/environments/environment.staging.ts index cde8b82..043e6c2 100644 --- a/web/src/environments/environment.staging.ts +++ b/web/src/environments/environment.staging.ts @@ -4,4 +4,5 @@ export const environment = { production: false, + config: "config.json", }; diff --git a/web/src/environments/environment.ts b/web/src/environments/environment.ts index 66998ae..dafa98a 100644 --- a/web/src/environments/environment.ts +++ b/web/src/environments/environment.ts @@ -4,6 +4,7 @@ export const environment = { production: false, + config: "config.json", }; /*