1- // @ts -expect-error not a dependency
21import { defineConfig } from '@graphql-hive/gateway' ;
3- // @ts -expect-error not a dependency
42import { hiveTracingSetup } from '@graphql-hive/plugin-opentelemetry/setup' ;
53import type { Context } from '@opentelemetry/api' ;
64import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks' ;
6967 // Noop is only there to not raise an exception in case we do not hive console tracing.
7068 target : process . env [ 'HIVE_HIVE_TARGET' ] ?? 'noop' ,
7169 contextManager : new AsyncLocalStorageContextManager ( ) ,
70+ // @ts -expect-error console uses otel v1 and hive gateway uses v2
71+ // TODO: upgrade console to otel v2
7272 processor : new MultiSpanProcessor ( [
7373 ...( process . env [ 'HIVE_HIVE_TRACE_ACCESS_TOKEN' ] &&
7474 process . env [ 'HIVE_HIVE_TRACE_ENDPOINT' ] &&
@@ -111,8 +111,8 @@ export const gatewayConfig = defineConfig({
111111 } ,
112112 supergraph : {
113113 type : 'hive' ,
114- endpoint : process . env [ 'SUPERGRAPH_ENDPOINT' ] ,
115- key : process . env [ 'HIVE_CDN_ACCESS_TOKEN' ] ,
114+ endpoint : process . env [ 'SUPERGRAPH_ENDPOINT' ] || '' ,
115+ key : process . env [ 'HIVE_CDN_ACCESS_TOKEN' ] || '' ,
116116 } ,
117117 graphiql : {
118118 title : 'Hive Console - GraphQL API' ,
@@ -127,12 +127,13 @@ export const gatewayConfig = defineConfig({
127127 } ,
128128 } ,
129129 disableWebsockets : true ,
130- prometheus : true ,
130+ prometheus : {
131+ metrics : true ,
132+ } ,
131133 openTelemetry :
132134 process . env [ 'OPENTELEMETRY_COLLECTOR_ENDPOINT' ] || process . env [ 'HIVE_HIVE_TRACE_ACCESS_TOKEN' ]
133135 ? {
134136 traces : true ,
135- serviceName : 'public-graphql-api-gateway' ,
136137 }
137138 : undefined ,
138139 demandControl : {
@@ -141,4 +142,8 @@ export const gatewayConfig = defineConfig({
141142 } ,
142143 maxTokens : 1_000 ,
143144 maxDepth : 20 ,
145+ cors : {
146+ origin : '*' , // allow all origins
147+ credentials : false , // do not allow credentials in cross-origin requests
148+ } ,
144149} ) ;
0 commit comments