change wachterServiceName to claim management service

This commit is contained in:
Rinat Arsaev 2022-07-19 20:11:06 +03:00
parent afb9894e92
commit 388b1580e4
5 changed files with 12 additions and 2 deletions

View File

@ -9,6 +9,7 @@ const THRIFT_PROXY_CONFIG = {
'/file_storage',
'/deanonimus',
'/payout/management',
'/wachter',
],
target: process.env.PROXY_TARGET,
secure: false,

View File

@ -13,7 +13,8 @@ export class ClaimManagementService extends createThriftApi<CodegenClient>() {
constructor(injector: Injector) {
super(injector, {
service,
path: '/v1/cm',
wachterServiceName: 'claimManagement',
path: '/wachter',
metadata: () => import('@vality/domain-proto/lib/metadata.json').then((m) => m.default),
context,
...codegenClientConfig,

View File

@ -3,6 +3,7 @@ export interface ThriftApiOptions {
service: object;
serviceName: string;
path: string;
wachterServiceName?: string;
hostname?: string;
port?: string;
metadata: () => Promise<any>;

View File

@ -38,7 +38,11 @@ export class ThriftConnector {
this.options.port || location.port,
this.options.path,
this.options.service,
toConnectOptions(token, this.options.deprecatedHeaders),
toConnectOptions(
token,
this.options.wachterServiceName,
this.options.deprecatedHeaders
),
(err) => {
observer.error(err);
observer.complete();

View File

@ -18,6 +18,7 @@ const toHeaders = (email: string, username: string, partyID: string, realm: stri
export const toConnectOptions = (
{ email, sub, preferred_username }: KeycloakToken,
serviceName: string,
deprecatedHeaders = false,
realm = 'internal'
): ConnectOptions => ({
@ -26,6 +27,8 @@ export const toConnectOptions = (
...(deprecatedHeaders
? toDepricatedHeaders(email, preferred_username, sub, realm)
: undefined),
// eslint-disable-next-line @typescript-eslint/naming-convention
...(serviceName ? { Service: serviceName } : {}),
},
deadlineConfig: {
amount: 3,