From 0a5e5f70fa414a615554c832a336d18ff458fe52 Mon Sep 17 00:00:00 2001 From: Rinat Arsaev <11846445+A77AY@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:06:48 +0700 Subject: [PATCH] TD-730,TD-775: Wachter config to appConfig, add headers logging, fix errors logging (#267) --- README.md | 4 +- _.env | 1 - package-lock.json | 66 ++++++++----------- package.json | 19 +++--- proxy.conf.js | 27 -------- src/app/api/accounter/accounter.service.ts | 9 ++- .../claim-management.service.ts | 9 ++- src/app/api/deanonimus/deanonimus.service.ts | 9 ++- src/app/api/deposit/management.service.ts | 9 ++- .../api/domain-config/repository.service.ts | 9 ++- .../dominant-cache/dominant-cache.service.ts | 2 +- .../fistful-admin/fistful-admin.service.ts | 9 ++- .../fistful-statistics.service.ts | 9 ++- .../magista/merchant-statistics.service.ts | 9 ++- .../payment-processing/invoicing.service.ts | 9 ++- .../party-management.service.ts | 9 ++- .../payout-management.service.ts | 9 ++- .../api/repairer/repair-management.service.ts | 9 ++- src/app/api/wallet/management.service.ts | 9 ++- src/app/api/withdrawal/management.service.ts | 9 ++- src/app/core/types/app-config.ts | 10 +++ src/assets/_appConfig.json | 8 ++- 22 files changed, 154 insertions(+), 109 deletions(-) delete mode 100644 _.env delete mode 100644 proxy.conf.js diff --git a/README.md b/README.md index 7f36a1d5..bed144e7 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,8 @@ Admin Dashboard ## ⚙️ Installation -1. Add environment and configurations: +1. Add configurations: - - [`.env`](./_.env) - [`src/assets/appConfig.json`](./src/assets/_appConfig.json) - [`src/assets/authConfig.json`](./src/assets/_authConfig.json) @@ -21,7 +20,6 @@ You can copy from examples like this one: [`_appConfig.json`](./src/assets/_appC Running in stage mode needs files: -- `.env.stage` - `src/assets/appConfig.stage.json` - `src/assets/authConfig.stage.json` diff --git a/_.env b/_.env deleted file mode 100644 index 34868f40..00000000 --- a/_.env +++ /dev/null @@ -1 +0,0 @@ -PROXY_TARGET="https://control-center.sample.vality.dev" diff --git a/package-lock.json b/package-lock.json index 4d1c024d..117d1eba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,14 +24,14 @@ "@ngneat/input-mask": "6.0.0", "@ngneat/until-destroy": "9.2.2", "@s-libs/ng-core": "16.0.0", - "@vality/deanonimus-proto": "2.0.1-2a3d5ad.0", - "@vality/domain-proto": "2.0.1-c65fc2e.0", - "@vality/dominant-cache-proto": "2.0.1-99f38c9.0", - "@vality/fistful-proto": "2.0.0", - "@vality/magista-proto": "2.0.2-e46bba2.0", + "@vality/deanonimus-proto": "2.0.0", + "@vality/domain-proto": "2.0.1-f718741.0", + "@vality/dominant-cache-proto": "2.0.0", + "@vality/fistful-proto": "2.0.1-ed97a0e.0", + "@vality/magista-proto": "2.0.2-37b81e6.0", "@vality/ng-core": "16.2.1-pr-40-5f4b5be.0", - "@vality/payout-manager-proto": "2.0.1-b079679.0", - "@vality/repairer-proto": "2.0.1-8f7973d.0", + "@vality/payout-manager-proto": "2.0.0", + "@vality/repairer-proto": "2.0.2-f5e3b7a.0", "@vality/thrift-ts": "2.4.1-8ad5123.0", "@vality/woody": "0.1.1", "coerce-property": "15.0.1", @@ -70,7 +70,6 @@ "@vality/prettier-config": "3.0.1-pr-33-1086ab7.0", "cross-env": "7.0.3", "cspell": "^7.0.0", - "dotenv": "16.0.0", "eslint": "^8.39.0", "jasmine-core": "4.2.0", "jasmine-spec-reporter": "7.0.0", @@ -5769,19 +5768,19 @@ } }, "node_modules/@vality/deanonimus-proto": { - "version": "2.0.1-2a3d5ad.0", - "resolved": "https://registry.npmjs.org/@vality/deanonimus-proto/-/deanonimus-proto-2.0.1-2a3d5ad.0.tgz", - "integrity": "sha512-p/kR6o1mTWatvzpltDbSzJjRiA75ph8N5CZm5FTa+5ZgGer9pSN4sZhRGJj/iIfZkXZuVNZp9kisS+4+QKx13A==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@vality/deanonimus-proto/-/deanonimus-proto-2.0.0.tgz", + "integrity": "sha512-yJ461cgtyvhwZ90dzJX0EeforN4NQhnA9MoBpU1aocPB6C1gNJFUa5+29d5OFg00zbw1/eW12dVd/pKEakjGKA==" }, "node_modules/@vality/domain-proto": { - "version": "2.0.1-c65fc2e.0", - "resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-2.0.1-c65fc2e.0.tgz", - "integrity": "sha512-ZJiIvl4F1Np821XHxzACw0KNk8wF9u7QOjW4XaJZ88b4N99Sp5DdQKWZPHRRGmj27nORqam9DxZdwdV0KoEabw==" + "version": "2.0.1-f718741.0", + "resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-2.0.1-f718741.0.tgz", + "integrity": "sha512-YHnB5UTWZrg13y19Th1R0hffazsqrrVOWhw4eD1kXvCC16uy8h/+Ys9iReayjqZuNc7lxQo39HsAfsHksYDEQQ==" }, "node_modules/@vality/dominant-cache-proto": { - "version": "2.0.1-99f38c9.0", - "resolved": "https://registry.npmjs.org/@vality/dominant-cache-proto/-/dominant-cache-proto-2.0.1-99f38c9.0.tgz", - "integrity": "sha512-8cVI0giJwXxj4KBG4sAvZ6TrnwlWNKCRQVghufsJOoW1B+z1QbyfoAKZe2WTtrod2jRxbhOWQ9ebv0wxRx4Pog==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@vality/dominant-cache-proto/-/dominant-cache-proto-2.0.0.tgz", + "integrity": "sha512-Jxo7n8/2xo8D/y7g0v1iFjr5MijOYmJ0hiHNTqoj/D0elzRhHAeRBur9F8h4RDf6sd2/+FmtVlprc7+q0/AGig==" }, "node_modules/@vality/eslint-config": { "version": "8.0.1-pr-33-541079b.0", @@ -5991,14 +5990,14 @@ } }, "node_modules/@vality/fistful-proto": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@vality/fistful-proto/-/fistful-proto-2.0.0.tgz", - "integrity": "sha512-CAU7aumScf4t3/TMV42SS5E/7oM5EfXiLbLp2TAzJoE+u5Qht4ycWPvlziYrcvayWoaHyCKW8w1CvbdiqBRZjw==" + "version": "2.0.1-ed97a0e.0", + "resolved": "https://registry.npmjs.org/@vality/fistful-proto/-/fistful-proto-2.0.1-ed97a0e.0.tgz", + "integrity": "sha512-5dySIV3rgocHr2ZYB26dqHBquv8+yNOPMP7huU5aXqYFDVEy4M/4igrROcRWc8nCBtaOkKvRIBhrGhlQzgijiQ==" }, "node_modules/@vality/magista-proto": { - "version": "2.0.2-e46bba2.0", - "resolved": "https://registry.npmjs.org/@vality/magista-proto/-/magista-proto-2.0.2-e46bba2.0.tgz", - "integrity": "sha512-2cPVToAJRdt1CFQ6G/C6ngw6hp94Jp7WFtPtNvtlcCSXRYRnppoi3KpK14tBH9SlLeqrpSy0IrIsCnAkj7tFfg==" + "version": "2.0.2-37b81e6.0", + "resolved": "https://registry.npmjs.org/@vality/magista-proto/-/magista-proto-2.0.2-37b81e6.0.tgz", + "integrity": "sha512-gJizpTWuB74L+XuJ+dUaxAwJDkycdnuVwrXWIl/NKcS7++/zgrgTpw+tM5/Te3rWqkkCnSxC1SK0C4aPbbtifg==" }, "node_modules/@vality/ng-core": { "version": "16.2.1-pr-40-5f4b5be.0", @@ -6028,9 +6027,9 @@ } }, "node_modules/@vality/payout-manager-proto": { - "version": "2.0.1-b079679.0", - "resolved": "https://registry.npmjs.org/@vality/payout-manager-proto/-/payout-manager-proto-2.0.1-b079679.0.tgz", - "integrity": "sha512-KcojE7liP3rhPounDpmzWAcKwGyqTNaYWg8Bn3NB1bERTxVbzelvcBVt49PvueJsDQRXhGg/6jBoYMD+9iES+g==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@vality/payout-manager-proto/-/payout-manager-proto-2.0.0.tgz", + "integrity": "sha512-eBR/QJQObjfRQPOSR29vafvvfYVaAvrKJGYVxGo7j4ZWWf9KWDlR4cipixNnZyZ/esLNX2fdqebWbfogrOBdSA==" }, "node_modules/@vality/prettier-config": { "version": "3.0.1-pr-33-1086ab7.0", @@ -6045,9 +6044,9 @@ } }, "node_modules/@vality/repairer-proto": { - "version": "2.0.1-8f7973d.0", - "resolved": "https://registry.npmjs.org/@vality/repairer-proto/-/repairer-proto-2.0.1-8f7973d.0.tgz", - "integrity": "sha512-9/xlI6Q3yP0UUtcP5RGmy9H1lMzC/kNOlJCpoW7vNVtPbnHIwRLSOIL63+aGaNCCqlzeZPky7o57c1D3El05kQ==" + "version": "2.0.2-f5e3b7a.0", + "resolved": "https://registry.npmjs.org/@vality/repairer-proto/-/repairer-proto-2.0.2-f5e3b7a.0.tgz", + "integrity": "sha512-/hpCVTAkTY4ovYMB16SSldkQebYQbthmqvx+HUwFX6F05kLCN8Kvxabyuwf7GrgpoPfJyri0B/A3nraxa0KW+g==" }, "node_modules/@vality/thrift-ts": { "version": "2.4.1-8ad5123.0", @@ -11253,15 +11252,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/dotenv": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", - "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==", - "dev": true, - "engines": { - "node": ">=12" - } - }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", diff --git a/package.json b/package.json index 29879b86..9797bfc1 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.0.0", "private": true, "scripts": { - "start": "ng serve --proxy-config proxy.conf.js --port 4200", - "stage": "cross-env NODE_ENV=stage ng serve --proxy-config proxy.conf.js --port 4201 --configuration=stage", + "start": "ng serve --port 4200", + "stage": "cross-env NODE_ENV=stage ng serve --port 4201 --configuration=stage", "build": "ng build", "test": "ng test", "lint": "ng lint --max-warnings=0", @@ -32,14 +32,14 @@ "@ngneat/input-mask": "6.0.0", "@ngneat/until-destroy": "9.2.2", "@s-libs/ng-core": "16.0.0", - "@vality/deanonimus-proto": "2.0.1-2a3d5ad.0", - "@vality/domain-proto": "2.0.1-c65fc2e.0", - "@vality/dominant-cache-proto": "2.0.1-99f38c9.0", - "@vality/fistful-proto": "2.0.0", - "@vality/magista-proto": "2.0.2-e46bba2.0", + "@vality/deanonimus-proto": "2.0.0", + "@vality/domain-proto": "2.0.1-f718741.0", + "@vality/dominant-cache-proto": "2.0.0", + "@vality/fistful-proto": "2.0.1-ed97a0e.0", + "@vality/magista-proto": "2.0.2-37b81e6.0", "@vality/ng-core": "16.2.1-pr-40-5f4b5be.0", - "@vality/payout-manager-proto": "2.0.1-b079679.0", - "@vality/repairer-proto": "2.0.1-8f7973d.0", + "@vality/payout-manager-proto": "2.0.0", + "@vality/repairer-proto": "2.0.2-f5e3b7a.0", "@vality/thrift-ts": "2.4.1-8ad5123.0", "@vality/woody": "0.1.1", "coerce-property": "15.0.1", @@ -78,7 +78,6 @@ "@vality/prettier-config": "3.0.1-pr-33-1086ab7.0", "cross-env": "7.0.3", "cspell": "^7.0.0", - "dotenv": "16.0.0", "eslint": "^8.39.0", "jasmine-core": "4.2.0", "jasmine-spec-reporter": "7.0.0", diff --git a/proxy.conf.js b/proxy.conf.js deleted file mode 100644 index c1be9bd5..00000000 --- a/proxy.conf.js +++ /dev/null @@ -1,27 +0,0 @@ -require('dotenv').config({ path: ['.env', process.env.NODE_ENV].filter(Boolean).join('.') }); - -const { PROXY_TARGET } = process.env; -const REQUIRED_ENV = [PROXY_TARGET]; - -if (REQUIRED_ENV.findIndex((e) => !e) !== -1) { - throw new Error('[proxy.conf.js] Set required environment variables!'); -} - -module.exports = [ - { - context: [ - '/v1', - '/v3', - '/stat', - '/fistful', - '/file_storage', - '/deanonimus', - '/payout/management', - '/wachter', - ], - target: PROXY_TARGET, - secure: false, - logLevel: 'debug', - changeOrigin: true, - }, -]; diff --git a/src/app/api/accounter/accounter.service.ts b/src/app/api/accounter/accounter.service.ts index 7ea01888..7588d32a 100644 --- a/src/app/api/accounter/accounter.service.ts +++ b/src/app/api/accounter/accounter.service.ts @@ -11,11 +11,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class AccounterService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('Accounter')), ); @@ -30,7 +35,7 @@ export class AccounterService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/claim-management/claim-management.service.ts b/src/app/api/claim-management/claim-management.service.ts index 91c2e6bf..bf3a11c5 100644 --- a/src/app/api/claim-management/claim-management.service.ts +++ b/src/app/api/claim-management/claim-management.service.ts @@ -20,11 +20,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class ClaimManagementService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('ClaimManagement')), ); @@ -39,7 +44,7 @@ export class ClaimManagementService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/deanonimus/deanonimus.service.ts b/src/app/api/deanonimus/deanonimus.service.ts index b66c68c1..5b34c320 100644 --- a/src/app/api/deanonimus/deanonimus.service.ts +++ b/src/app/api/deanonimus/deanonimus.service.ts @@ -10,11 +10,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class DeanonimusService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('Deanonimus')), ); @@ -29,7 +34,7 @@ export class DeanonimusService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/deposit/management.service.ts b/src/app/api/deposit/management.service.ts index 7c0d3ff6..1d196e51 100644 --- a/src/app/api/deposit/management.service.ts +++ b/src/app/api/deposit/management.service.ts @@ -12,11 +12,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class ManagementService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('DepositManagement')), ); @@ -31,7 +36,7 @@ export class ManagementService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/domain-config/repository.service.ts b/src/app/api/domain-config/repository.service.ts index 9a14bebf..bcd4cc1d 100644 --- a/src/app/api/domain-config/repository.service.ts +++ b/src/app/api/domain-config/repository.service.ts @@ -10,11 +10,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class RepositoryService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('Domain')), ); @@ -29,7 +34,7 @@ export class RepositoryService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/dominant-cache/dominant-cache.service.ts b/src/app/api/dominant-cache/dominant-cache.service.ts index 9c768571..5184055c 100644 --- a/src/app/api/dominant-cache/dominant-cache.service.ts +++ b/src/app/api/dominant-cache/dominant-cache.service.ts @@ -29,7 +29,7 @@ export class DominantCacheService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/fistful-admin/fistful-admin.service.ts b/src/app/api/fistful-admin/fistful-admin.service.ts index 9d33c534..7a696f9b 100644 --- a/src/app/api/fistful-admin/fistful-admin.service.ts +++ b/src/app/api/fistful-admin/fistful-admin.service.ts @@ -12,11 +12,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class FistfulAdminService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('FistfulAdmin')), ); @@ -31,7 +36,7 @@ export class FistfulAdminService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/fistful-stat/fistful-statistics.service.ts b/src/app/api/fistful-stat/fistful-statistics.service.ts index bb0f2094..a20ea34a 100644 --- a/src/app/api/fistful-stat/fistful-statistics.service.ts +++ b/src/app/api/fistful-stat/fistful-statistics.service.ts @@ -10,11 +10,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class FistfulStatisticsService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('FistfulStatistics')), ); @@ -29,7 +34,7 @@ export class FistfulStatisticsService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/magista/merchant-statistics.service.ts b/src/app/api/magista/merchant-statistics.service.ts index a8da24a4..b02ed385 100644 --- a/src/app/api/magista/merchant-statistics.service.ts +++ b/src/app/api/magista/merchant-statistics.service.ts @@ -18,11 +18,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class MerchantStatisticsService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('MerchantStatistics')), ); @@ -37,7 +42,7 @@ export class MerchantStatisticsService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/payment-processing/invoicing.service.ts b/src/app/api/payment-processing/invoicing.service.ts index fc5b53fe..25fc982f 100644 --- a/src/app/api/payment-processing/invoicing.service.ts +++ b/src/app/api/payment-processing/invoicing.service.ts @@ -25,11 +25,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class InvoicingService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('Invoicing')), ); @@ -44,7 +49,7 @@ export class InvoicingService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/payment-processing/party-management.service.ts b/src/app/api/payment-processing/party-management.service.ts index f5d2ea9f..8472e18b 100644 --- a/src/app/api/payment-processing/party-management.service.ts +++ b/src/app/api/payment-processing/party-management.service.ts @@ -11,11 +11,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class PartyManagementService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('PartyManagement')), ); @@ -30,7 +35,7 @@ export class PartyManagementService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/payout-manager/payout-management.service.ts b/src/app/api/payout-manager/payout-management.service.ts index 56356c1e..dfd12dd4 100644 --- a/src/app/api/payout-manager/payout-management.service.ts +++ b/src/app/api/payout-manager/payout-management.service.ts @@ -10,11 +10,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class PayoutManagementService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('PayoutManagement')), ); @@ -29,7 +34,7 @@ export class PayoutManagementService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/repairer/repair-management.service.ts b/src/app/api/repairer/repair-management.service.ts index d5e65cfb..95057e24 100644 --- a/src/app/api/repairer/repair-management.service.ts +++ b/src/app/api/repairer/repair-management.service.ts @@ -16,11 +16,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class RepairManagementService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('RepairManagement')), ); @@ -35,7 +40,7 @@ export class RepairManagementService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/wallet/management.service.ts b/src/app/api/wallet/management.service.ts index f702b9be..4f2c86bd 100644 --- a/src/app/api/wallet/management.service.ts +++ b/src/app/api/wallet/management.service.ts @@ -12,11 +12,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class ManagementService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('WalletManagement')), ); @@ -31,7 +36,7 @@ export class ManagementService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/api/withdrawal/management.service.ts b/src/app/api/withdrawal/management.service.ts index caf40eca..3f8ef704 100644 --- a/src/app/api/withdrawal/management.service.ts +++ b/src/app/api/withdrawal/management.service.ts @@ -11,11 +11,16 @@ import { combineLatest, from, map, Observable, switchMap } from 'rxjs'; import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services'; import { environment } from '@cc/environments/environment'; +import { ConfigService } from '../../core/config.service'; + @Injectable({ providedIn: 'root' }) export class ManagementService { private client$: Observable; - constructor(private keycloakTokenInfoService: KeycloakTokenInfoService) { + constructor( + private keycloakTokenInfoService: KeycloakTokenInfoService, + configService: ConfigService, + ) { const headers$ = this.keycloakTokenInfoService.decoded$.pipe( map(toWachterHeaders('WithdrawalManagement')), ); @@ -30,7 +35,7 @@ export class ManagementService { metadata, headers, logging: environment.logging.requests, - path: '/wachter', + ...configService.config.api.wachter, }), ), ); diff --git a/src/app/core/types/app-config.ts b/src/app/core/types/app-config.ts index 0b48acc2..11882e18 100644 --- a/src/app/core/types/app-config.ts +++ b/src/app/core/types/app-config.ts @@ -1,3 +1,13 @@ +interface Endpoint { + hostname: string; + path: string; + port?: string; + https?: boolean; +} + export interface AppConfig { fileStorageEndpoint: string; + api: { + wachter: Endpoint; + }; } diff --git a/src/assets/_appConfig.json b/src/assets/_appConfig.json index 4434db28..0339c981 100644 --- a/src/assets/_appConfig.json +++ b/src/assets/_appConfig.json @@ -1,3 +1,9 @@ { - "fileStorageEndpoint": "https://files.sample.vality.dev" + "fileStorageEndpoint": "https://files.sample.vality.dev", + "api": { + "wachter": { + "hostname": "control-center.vality.dev", + "path": "/wachter" + } + } }