Skip to content

Commit

Permalink
feat: ✨ add subgraphsConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
zhumeisongsong committed Nov 8, 2024
1 parent 1af6fd8 commit dbea347
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/application-config/src/lib/applications-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
interface ApplicationConfig {
host: string;
port: string;
name: string;
}

const DEFAULT_HOST = 'localhost';
Expand All @@ -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',
};
10 changes: 10 additions & 0 deletions libs/application-config/src/lib/subgraphs-config.ts
Original file line number Diff line number Diff line change
@@ -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`,
},
];

0 comments on commit dbea347

Please sign in to comment.