diff --git a/.changeset/fluffy-vans-shake.md b/.changeset/fluffy-vans-shake.md new file mode 100644 index 0000000000000..42b0bca3d8575 --- /dev/null +++ b/.changeset/fluffy-vans-shake.md @@ -0,0 +1,5 @@ +--- +'@graphql-mesh/graphql': patch +--- + +Support string interpolation for `subscriptionsEndpoint` diff --git a/.changeset/short-candles-explain.md b/.changeset/short-candles-explain.md new file mode 100644 index 0000000000000..42b0bca3d8575 --- /dev/null +++ b/.changeset/short-candles-explain.md @@ -0,0 +1,5 @@ +--- +'@graphql-mesh/graphql': patch +--- + +Support string interpolation for `subscriptionsEndpoint` diff --git a/packages/handlers/graphql/src/index.ts b/packages/handlers/graphql/src/index.ts index 36ea3321a31f6..5b2bbc49a4507 100644 --- a/packages/handlers/graphql/src/index.ts +++ b/packages/handlers/graphql/src/index.ts @@ -18,6 +18,7 @@ import { getInterpolatedHeadersFactory, getInterpolatedStringFactory, parseInterpolationStrings, + stringInterpolator, } from '@graphql-mesh/string-interpolation'; import { GetMeshSourcePayload, @@ -115,8 +116,13 @@ export default class GraphQLHandler implements MeshHandler { const endpointFactory = getInterpolatedStringFactory(endpoint); const operationHeadersFactory = getInterpolatedHeadersFactory(operationHeaders); + + const subscriptionsEndpoint = httpSourceConfig.subscriptionsEndpoint + ? stringInterpolator.parse(httpSourceConfig.subscriptionsEndpoint, { env: process.env }) + : undefined; const executor = this.urlLoader.getExecutorAsync(endpoint, { ...httpSourceConfig, + subscriptionsEndpoint, subscriptionsProtocol: httpSourceConfig.subscriptionsProtocol as SubscriptionProtocol, customFetch: this.fetchFn, });