From dbea347e942179c46d306e90ec815a32d3ddacac Mon Sep 17 00:00:00 2001 From: zhumeisongsong Date: Fri, 8 Nov 2024 13:23:18 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20subgraphsConfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/application-config/src/lib/applications-config.ts | 4 ++++ libs/application-config/src/lib/subgraphs-config.ts | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 libs/application-config/src/lib/subgraphs-config.ts diff --git a/libs/application-config/src/lib/applications-config.ts b/libs/application-config/src/lib/applications-config.ts index 4b6e66b..fce870a 100644 --- a/libs/application-config/src/lib/applications-config.ts +++ b/libs/application-config/src/lib/applications-config.ts @@ -1,6 +1,7 @@ interface ApplicationConfig { host: string; port: string; + name: string; } const DEFAULT_HOST = 'localhost'; @@ -15,15 +16,18 @@ const DEFAULT_PORT = { export const gatewayConfig: ApplicationConfig = { host: process.env['GATEWAY_HOST'] ?? DEFAULT_HOST, port: process.env['GATEWAY_PORT'] ?? DEFAULT_PORT.gateway, + name: 'gateway', }; // Graphql export const userSubGraph: ApplicationConfig = { host: process.env['USER_HOST'] ?? DEFAULT_HOST, port: process.env['USER_PORT'] ?? DEFAULT_PORT.user, + name: 'user', }; export const taskSubGraph: ApplicationConfig = { host: process.env['TASK_HOST'] ?? DEFAULT_HOST, port: process.env['TASK_PORT'] ?? DEFAULT_PORT.task, + name: 'task', }; diff --git a/libs/application-config/src/lib/subgraphs-config.ts b/libs/application-config/src/lib/subgraphs-config.ts new file mode 100644 index 0000000..4c59dd4 --- /dev/null +++ b/libs/application-config/src/lib/subgraphs-config.ts @@ -0,0 +1,10 @@ +import { ServiceEndpointDefinition } from '@apollo/gateway'; + +import { userSubGraph } from './applications-config'; + +export const subgraphsConfig: ServiceEndpointDefinition[] = [ + { + name: userSubGraph.name, + url: `${userSubGraph.host}:${userSubGraph.port}/graphql`, + }, +];