From 1362e23cf8f18b45c203528b3a06c84259163570 Mon Sep 17 00:00:00 2001 From: Guilherme Ananias Date: Thu, 30 Oct 2025 15:48:21 -0300 Subject: [PATCH 01/11] feat(cdn): add env for KV_BASE_URL flow on key-validation --- packages/services/cdn-worker/src/dev-polyfill.ts | 2 ++ packages/services/cdn-worker/src/dev.ts | 2 ++ packages/services/cdn-worker/src/env.ts | 7 +++++++ packages/services/cdn-worker/src/index.ts | 9 +++++++++ packages/services/cdn-worker/src/key-validation.ts | 6 ++++-- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/services/cdn-worker/src/dev-polyfill.ts b/packages/services/cdn-worker/src/dev-polyfill.ts index 23dd1d650ba..98cb77d080e 100644 --- a/packages/services/cdn-worker/src/dev-polyfill.ts +++ b/packages/services/cdn-worker/src/dev-polyfill.ts @@ -13,4 +13,6 @@ export const env: Env = { SENTRY_DSN: '', SENTRY_ENVIRONMENT: '', SENTRY_RELEASE: '', + // eslint-disable-next-line no-process-env + KV_STORAGE_BASE_URL: process.env.KV_STORAGE_BASE_URL, }; diff --git a/packages/services/cdn-worker/src/dev.ts b/packages/services/cdn-worker/src/dev.ts index 1945df77cb4..18d86569c80 100644 --- a/packages/services/cdn-worker/src/dev.ts +++ b/packages/services/cdn-worker/src/dev.ts @@ -27,6 +27,7 @@ const artifactStorageReader = new ArtifactStorageReader(s3, null, null, null); const handleRequest = createRequestHandler({ isKeyValid: createIsKeyValid({ + kvStorageBaseUrl: env.KV_STORAGE_BASE_URL, artifactStorageReader, getCache: null, waitUntil: null, @@ -52,6 +53,7 @@ const handleRequest = createRequestHandler({ const handleArtifactRequest = createArtifactRequestHandler({ isKeyValid: createIsKeyValid({ + kvStorageBaseUrl: env.KV_STORAGE_BASE_URL, artifactStorageReader, getCache: null, waitUntil: null, diff --git a/packages/services/cdn-worker/src/env.ts b/packages/services/cdn-worker/src/env.ts index fae1114bf99..6631fa0981e 100644 --- a/packages/services/cdn-worker/src/env.ts +++ b/packages/services/cdn-worker/src/env.ts @@ -16,4 +16,11 @@ export type Env = { * Id of the release */ SENTRY_RELEASE: string; + /** + * Base URL of the KV storage, used to fetch the schema from the KV storage. + * If not provideed, the schema will be fetched from default KV storage value. + * + * @default https://key-cache.graphql-hive.com + */ + KV_STORAGE_BASE_URL?: string; }; diff --git a/packages/services/cdn-worker/src/index.ts b/packages/services/cdn-worker/src/index.ts index 6a223a229aa..9aeb1de2b93 100644 --- a/packages/services/cdn-worker/src/index.ts +++ b/packages/services/cdn-worker/src/index.ts @@ -41,6 +41,14 @@ type Env = { R2_ANALYTICS: AnalyticsEngine; S3_ANALYTICS: AnalyticsEngine; KEY_VALIDATION_ANALYTICS: AnalyticsEngine; + + /** + * Base URL of the KV storage, used to fetch the schema from the KV storage. + * If not provideed, the schema will be fetched from default KV storage value. + * + * @default https://key-cache.graphql-hive.com + */ + KV_STORAGE_BASE_URL?: string; }; const handler: ExportedHandler = { @@ -108,6 +116,7 @@ const handler: ExportedHandler = { ); const isKeyValid = createIsKeyValid({ + kvStorageBaseUrl: env.KV_STORAGE_BASE_URL, waitUntil: p => ctx.waitUntil(p), getCache: () => caches.open('artifacts-auth'), artifactStorageReader, diff --git a/packages/services/cdn-worker/src/key-validation.ts b/packages/services/cdn-worker/src/key-validation.ts index 746106c86a7..9fd4caaf562 100644 --- a/packages/services/cdn-worker/src/key-validation.ts +++ b/packages/services/cdn-worker/src/key-validation.ts @@ -11,6 +11,7 @@ type WaitUntil = (promise: Promise) => void; type GetCache = () => Promise; type CreateKeyValidatorDeps = { + kvStorageBaseUrl?: string; waitUntil: null | WaitUntil; artifactStorageReader: ArtifactStorageReader; getCache: null | GetCache; @@ -34,6 +35,7 @@ export const createIsKeyValid = }; const handleLegacyCDNAccessToken = async (args: { + kvStorageBaseUrl?: string; targetId: string; accessToken: string; artifactStorageReader: ArtifactStorageReader; @@ -49,7 +51,7 @@ const handleLegacyCDNAccessToken = async (args: { if (requestCache) { const cacheKey = new Request( [ - 'https://key-cache.graphql-hive.com', + args.kvStorageBaseUrl ?? 'https://key-cache.graphql-hive.com', 'legacy', args.targetId, encodeURIComponent(args.accessToken), @@ -150,7 +152,7 @@ async function handleCDNAccessToken( if (requestCache) { const cacheKey = new Request( - ['http://key-cache.graphql-hive.com', 'v1', targetId, encodeURIComponent(accessToken)].join( + [deps.kvStorageBaseUrl ?? 'https://key-cache.graphql-hive.com', 'v1', targetId, encodeURIComponent(accessToken)].join( '/', ), { From ae680d712587fc5eb8ec4b32a31162d1d24f0dee Mon Sep 17 00:00:00 2001 From: Guilherme Ananias Date: Thu, 30 Oct 2025 15:48:41 -0300 Subject: [PATCH 02/11] feat(cdn): expose an env to manage KV URL compatibility with CDN on API provider --- packages/services/server/src/environment.ts | 9 ++++++++- packages/services/server/src/index.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/services/server/src/environment.ts b/packages/services/server/src/environment.ts index 00f74df3b9f..48550de9a00 100644 --- a/packages/services/server/src/environment.ts +++ b/packages/services/server/src/environment.ts @@ -118,6 +118,7 @@ const CdnCFModel = zod.union([ zod.object({ CDN_CF: zod.literal('1'), CDN_CF_BASE_URL: zod.string(), + CDN_CF_KV_BASE_URL: emptyString(zod.string().url().optional()), }), ]); @@ -128,6 +129,7 @@ const CdnApiModel = zod.union([ zod.object({ CDN_API: zod.literal('1'), CDN_API_BASE_URL: zod.string(), + CDN_API_KV_BASE_URL: emptyString(zod.string().url().optional()), }), ]); @@ -447,9 +449,14 @@ export const env = { cdnCf.CDN_CF === '1' ? { baseUrl: cdnCf.CDN_CF_BASE_URL, + kv: cdnCf.CDN_CF_KV_BASE_URL ? { baseUrl: cdnCf.CDN_CF_KV_BASE_URL } : null, } : null, - api: cdnApi.CDN_API === '1' ? { baseUrl: cdnApi.CDN_API_BASE_URL } : null, + api: cdnApi.CDN_API === '1' + ? { + baseUrl: cdnApi.CDN_API_BASE_URL, + kv: cdnApi.CDN_API_KV_BASE_URL ? { baseUrl: cdnApi.CDN_API_KV_BASE_URL } : null, + } : null,, }, }, s3: { diff --git a/packages/services/server/src/index.ts b/packages/services/server/src/index.ts index bf29d4d0688..cc673faf4fa 100644 --- a/packages/services/server/src/index.ts +++ b/packages/services/server/src/index.ts @@ -631,6 +631,7 @@ export async function main() { const artifactHandler = createArtifactRequestHandler({ isKeyValid: createIsKeyValid({ + kvStorageBaseUrl: env.cdn.providers.api.kv?.baseUrl, artifactStorageReader, analytics: null, breadcrumb(message: string) { From 8876c6aa1e854a0c14d3fe667bf08d06d0c117e6 Mon Sep 17 00:00:00 2001 From: Guilherme Ananias Date: Thu, 30 Oct 2025 15:48:57 -0300 Subject: [PATCH 03/11] docs(cdn): update doc with new envs related to KV_BASE_URL --- packages/services/server/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/services/server/README.md b/packages/services/server/README.md index 10f8fc5981d..3228b74501a 100644 --- a/packages/services/server/README.md +++ b/packages/services/server/README.md @@ -45,6 +45,7 @@ The GraphQL API for GraphQL Hive. | `S3_MIRROR_PUBLIC_URL` | No | The public URL of the S3, in case it differs from the `S3_ENDPOINT`. | `http://localhost:8083` | | `CDN_API` | No | Whether the CDN exposed via API is enabled. | `1` (enabled) or `0` (disabled) | | `CDN_API_BASE_URL` | No (Yes if `CDN_API` is set to `1`) | The public base url of the API service. | `http://localhost:8082` | +| `CDN_API_KV_BASE_URL` | No (**Optional** if `CDN_API` is set to `1`) | The base URL for the KV for OIDC related endpoints. | `https://key-cache.graphql-hive.com` | | `SUPERTOKENS_CONNECTION_URI` | **Yes** | The URI of the SuperTokens instance. | `http://127.0.0.1:3567` | | `SUPERTOKENS_API_KEY` | **Yes** | The API KEY of the SuperTokens instance. | `iliketurtlesandicannotlie` | | `AUTH_GITHUB` | No | Whether login via GitHub should be allowed | `1` (enabled) or `0` (disabled) | @@ -94,6 +95,7 @@ version. | `COMMERCE_ENDPOINT` | **Yes** | The endpoint of the commerce service. | `http://127.0.0.1:4012` | | `CDN_CF` | No | Whether the CDN is enabled. | `1` (enabled) or `0` (disabled) | | `CDN_CF_BASE_URL` | No (**Yes** if `CDN` is `1`) | The base URL of the cdn. | `https://cdn.graphql-hive.com` | +| `CDN_CF_KV_BASE_URL` | No (**Optional** if `CDN` is `1`) | The base URL for the KV using CloudFlare provider | `https://key-cache.graphql-hive.com` | | `HIVE_USAGE` | No | Whether usage reporting for the GraphQL API to Hive is enabled | `1` (enabled) or `0` (disabled) | | `HIVE_USAGE_TARGET` | No (**Yes** if `HIVE` is set to `1`) | The target to which the usage data should be reported | `the-guild/graphql-hive/development` | | `HIVE_USAGE_ACCESS_TOKEN` | No (**Yes** if `HIVE` is set to `1`) | The internal endpoint key. | `iliketurtles` | From 0ddbe0f8b2888abad172e6103eb58862ae6daa72 Mon Sep 17 00:00:00 2001 From: Guilherme Date: Thu, 30 Oct 2025 15:55:38 -0300 Subject: [PATCH 04/11] style: fix typo on environment setup Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/services/server/src/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/services/server/src/environment.ts b/packages/services/server/src/environment.ts index 48550de9a00..3e732dbeb9e 100644 --- a/packages/services/server/src/environment.ts +++ b/packages/services/server/src/environment.ts @@ -456,7 +456,7 @@ export const env = { ? { baseUrl: cdnApi.CDN_API_BASE_URL, kv: cdnApi.CDN_API_KV_BASE_URL ? { baseUrl: cdnApi.CDN_API_KV_BASE_URL } : null, - } : null,, + } : null, }, }, s3: { From d5664bfd2b907be96a501987dba0ca4544662d39 Mon Sep 17 00:00:00 2001 From: Guilherme Date: Thu, 30 Oct 2025 15:55:59 -0300 Subject: [PATCH 05/11] docs: fix typo on env documentation Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/services/cdn-worker/src/env.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/services/cdn-worker/src/env.ts b/packages/services/cdn-worker/src/env.ts index 6631fa0981e..dc481b624e2 100644 --- a/packages/services/cdn-worker/src/env.ts +++ b/packages/services/cdn-worker/src/env.ts @@ -18,7 +18,7 @@ export type Env = { SENTRY_RELEASE: string; /** * Base URL of the KV storage, used to fetch the schema from the KV storage. - * If not provideed, the schema will be fetched from default KV storage value. + * If not provided, the schema will be fetched from default KV storage value. * * @default https://key-cache.graphql-hive.com */ From e9a70c29efa46100dfed32567cd375cb400f5728 Mon Sep 17 00:00:00 2001 From: Guilherme Date: Thu, 30 Oct 2025 15:56:42 -0300 Subject: [PATCH 06/11] docs: fix typo on env documentation Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/services/cdn-worker/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/services/cdn-worker/src/index.ts b/packages/services/cdn-worker/src/index.ts index 9aeb1de2b93..158eadee880 100644 --- a/packages/services/cdn-worker/src/index.ts +++ b/packages/services/cdn-worker/src/index.ts @@ -44,7 +44,7 @@ type Env = { /** * Base URL of the KV storage, used to fetch the schema from the KV storage. - * If not provideed, the schema will be fetched from default KV storage value. + * If not provided, the schema will be fetched from default KV storage value. * * @default https://key-cache.graphql-hive.com */ From 1fc67e9279402c87f503d2da44f01a3250d04a9a Mon Sep 17 00:00:00 2001 From: Guilherme Ananias Date: Fri, 31 Oct 2025 12:44:27 -0300 Subject: [PATCH 07/11] docs(server): improve description of CDN base URL envs --- packages/services/server/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/services/server/README.md b/packages/services/server/README.md index 3228b74501a..b4a03312f73 100644 --- a/packages/services/server/README.md +++ b/packages/services/server/README.md @@ -45,7 +45,7 @@ The GraphQL API for GraphQL Hive. | `S3_MIRROR_PUBLIC_URL` | No | The public URL of the S3, in case it differs from the `S3_ENDPOINT`. | `http://localhost:8083` | | `CDN_API` | No | Whether the CDN exposed via API is enabled. | `1` (enabled) or `0` (disabled) | | `CDN_API_BASE_URL` | No (Yes if `CDN_API` is set to `1`) | The public base url of the API service. | `http://localhost:8082` | -| `CDN_API_KV_BASE_URL` | No (**Optional** if `CDN_API` is set to `1`) | The base URL for the KV for OIDC related endpoints. | `https://key-cache.graphql-hive.com` | +| `CDN_API_KV_BASE_URL` | No (**Optional** if `CDN_API` is set to `1`) | The base URL for the KV for API Provider. Used for scenarios where we cache CDN access. | `https://key-cache.graphql-hive.com` | | `SUPERTOKENS_CONNECTION_URI` | **Yes** | The URI of the SuperTokens instance. | `http://127.0.0.1:3567` | | `SUPERTOKENS_API_KEY` | **Yes** | The API KEY of the SuperTokens instance. | `iliketurtlesandicannotlie` | | `AUTH_GITHUB` | No | Whether login via GitHub should be allowed | `1` (enabled) or `0` (disabled) | @@ -90,13 +90,13 @@ The GraphQL API for GraphQL Hive. If you are self-hosting GraphQL Hive, you can ignore this section. It is only required for the Cloud version. -| Name | Required | Description | Example Value | -| ------------------------- | ------------------------------------ | -------------------------------------------------------------- | --------------------------------------------------- | -| `COMMERCE_ENDPOINT` | **Yes** | The endpoint of the commerce service. | `http://127.0.0.1:4012` | -| `CDN_CF` | No | Whether the CDN is enabled. | `1` (enabled) or `0` (disabled) | -| `CDN_CF_BASE_URL` | No (**Yes** if `CDN` is `1`) | The base URL of the cdn. | `https://cdn.graphql-hive.com` | -| `CDN_CF_KV_BASE_URL` | No (**Optional** if `CDN` is `1`) | The base URL for the KV using CloudFlare provider | `https://key-cache.graphql-hive.com` | -| `HIVE_USAGE` | No | Whether usage reporting for the GraphQL API to Hive is enabled | `1` (enabled) or `0` (disabled) | -| `HIVE_USAGE_TARGET` | No (**Yes** if `HIVE` is set to `1`) | The target to which the usage data should be reported | `the-guild/graphql-hive/development` | -| `HIVE_USAGE_ACCESS_TOKEN` | No (**Yes** if `HIVE` is set to `1`) | The internal endpoint key. | `iliketurtles` | -| `HIVE_USAGE_ENDPOINT` | No | The endpoint used for usage reporting. | `http://app.graphql-hive.com/usage` (default value) | +| Name | Required | Description | Example Value | +| ------------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | +| `COMMERCE_ENDPOINT` | **Yes** | The endpoint of the commerce service. | `http://127.0.0.1:4012` | +| `CDN_CF` | No | Whether the CDN is enabled. | `1` (enabled) or `0` (disabled) | +| `CDN_CF_BASE_URL` | No (**Yes** if `CDN` is `1`) | The base URL of the cdn. | `https://cdn.graphql-hive.com` | +| `CDN_CF_KV_BASE_URL` | No (**Optional** if `CDN` is `1`) | The base URL for the key-value store used for CDN access key validation caching when using the Cloudflare provider. | `https://key-cache.graphql-hive.com` | +| `HIVE_USAGE` | No | Whether usage reporting for the GraphQL API to Hive is enabled | `1` (enabled) or `0` (disabled) | +| `HIVE_USAGE_TARGET` | No (**Yes** if `HIVE` is set to `1`) | The target to which the usage data should be reported | `the-guild/graphql-hive/development` | +| `HIVE_USAGE_ACCESS_TOKEN` | No (**Yes** if `HIVE` is set to `1`) | The internal endpoint key. | `iliketurtles` | +| `HIVE_USAGE_ENDPOINT` | No | The endpoint used for usage reporting. | `http://app.graphql-hive.com/usage` (default value) | From bf50a430346e9ed246aa8c5cbe92fda3d72b0cc8 Mon Sep 17 00:00:00 2001 From: Guilherme Ananias Date: Wed, 5 Nov 2025 14:56:18 -0300 Subject: [PATCH 08/11] build: update changeset for hive --- .changeset/silly-kiwis-count.md | 5 +++++ configs/cargo/Cargo.lock | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/silly-kiwis-count.md diff --git a/.changeset/silly-kiwis-count.md b/.changeset/silly-kiwis-count.md new file mode 100644 index 00000000000..1e44e535b84 --- /dev/null +++ b/.changeset/silly-kiwis-count.md @@ -0,0 +1,5 @@ +--- +'hive': major +--- + +Add envs for KV namespace on Cloudflare CDN worker diff --git a/configs/cargo/Cargo.lock b/configs/cargo/Cargo.lock index 0dcadde5707..b68a30bf433 100644 --- a/configs/cargo/Cargo.lock +++ b/configs/cargo/Cargo.lock @@ -2604,7 +2604,7 @@ dependencies = [ [[package]] name = "hive-apollo-router-plugin" -version = "2.3.0" +version = "2.3.1" dependencies = [ "anyhow", "apollo-router", @@ -2638,7 +2638,7 @@ dependencies = [ [[package]] name = "hive-console-sdk" -version = "0.0.1" +version = "0.1.0" dependencies = [ "anyhow", "async-trait", From eca77936b784ba4676f4378f2e050759ce35c3f3 Mon Sep 17 00:00:00 2001 From: Guilherme Ananias Date: Wed, 5 Nov 2025 14:57:42 -0300 Subject: [PATCH 09/11] style: run prettier to fix linting issues on server/cdn-worker --- packages/services/cdn-worker/src/env.ts | 2 +- packages/services/cdn-worker/src/index.ts | 2 +- .../services/cdn-worker/src/key-validation.ts | 9 ++++++--- packages/services/server/README.md | 20 +++++++++---------- packages/services/server/src/environment.ts | 12 ++++++----- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/packages/services/cdn-worker/src/env.ts b/packages/services/cdn-worker/src/env.ts index dc481b624e2..6471b1d9bc2 100644 --- a/packages/services/cdn-worker/src/env.ts +++ b/packages/services/cdn-worker/src/env.ts @@ -19,7 +19,7 @@ export type Env = { /** * Base URL of the KV storage, used to fetch the schema from the KV storage. * If not provided, the schema will be fetched from default KV storage value. - * + * * @default https://key-cache.graphql-hive.com */ KV_STORAGE_BASE_URL?: string; diff --git a/packages/services/cdn-worker/src/index.ts b/packages/services/cdn-worker/src/index.ts index 158eadee880..6e12b6c5312 100644 --- a/packages/services/cdn-worker/src/index.ts +++ b/packages/services/cdn-worker/src/index.ts @@ -45,7 +45,7 @@ type Env = { /** * Base URL of the KV storage, used to fetch the schema from the KV storage. * If not provided, the schema will be fetched from default KV storage value. - * + * * @default https://key-cache.graphql-hive.com */ KV_STORAGE_BASE_URL?: string; diff --git a/packages/services/cdn-worker/src/key-validation.ts b/packages/services/cdn-worker/src/key-validation.ts index 9fd4caaf562..420b8b7956c 100644 --- a/packages/services/cdn-worker/src/key-validation.ts +++ b/packages/services/cdn-worker/src/key-validation.ts @@ -152,9 +152,12 @@ async function handleCDNAccessToken( if (requestCache) { const cacheKey = new Request( - [deps.kvStorageBaseUrl ?? 'https://key-cache.graphql-hive.com', 'v1', targetId, encodeURIComponent(accessToken)].join( - '/', - ), + [ + deps.kvStorageBaseUrl ?? 'https://key-cache.graphql-hive.com', + 'v1', + targetId, + encodeURIComponent(accessToken), + ].join('/'), { method: 'GET', }, diff --git a/packages/services/server/README.md b/packages/services/server/README.md index b4a03312f73..35c5a8f658a 100644 --- a/packages/services/server/README.md +++ b/packages/services/server/README.md @@ -90,13 +90,13 @@ The GraphQL API for GraphQL Hive. If you are self-hosting GraphQL Hive, you can ignore this section. It is only required for the Cloud version. -| Name | Required | Description | Example Value | -| ------------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -| `COMMERCE_ENDPOINT` | **Yes** | The endpoint of the commerce service. | `http://127.0.0.1:4012` | -| `CDN_CF` | No | Whether the CDN is enabled. | `1` (enabled) or `0` (disabled) | -| `CDN_CF_BASE_URL` | No (**Yes** if `CDN` is `1`) | The base URL of the cdn. | `https://cdn.graphql-hive.com` | -| `CDN_CF_KV_BASE_URL` | No (**Optional** if `CDN` is `1`) | The base URL for the key-value store used for CDN access key validation caching when using the Cloudflare provider. | `https://key-cache.graphql-hive.com` | -| `HIVE_USAGE` | No | Whether usage reporting for the GraphQL API to Hive is enabled | `1` (enabled) or `0` (disabled) | -| `HIVE_USAGE_TARGET` | No (**Yes** if `HIVE` is set to `1`) | The target to which the usage data should be reported | `the-guild/graphql-hive/development` | -| `HIVE_USAGE_ACCESS_TOKEN` | No (**Yes** if `HIVE` is set to `1`) | The internal endpoint key. | `iliketurtles` | -| `HIVE_USAGE_ENDPOINT` | No | The endpoint used for usage reporting. | `http://app.graphql-hive.com/usage` (default value) | +| Name | Required | Description | Example Value | +| ------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | +| `COMMERCE_ENDPOINT` | **Yes** | The endpoint of the commerce service. | `http://127.0.0.1:4012` | +| `CDN_CF` | No | Whether the CDN is enabled. | `1` (enabled) or `0` (disabled) | +| `CDN_CF_BASE_URL` | No (**Yes** if `CDN` is `1`) | The base URL of the cdn. | `https://cdn.graphql-hive.com` | +| `CDN_CF_KV_BASE_URL` | No (**Optional** if `CDN` is `1`) | The base URL for the key-value store used for CDN access key validation caching when using the Cloudflare provider. | `https://key-cache.graphql-hive.com` | +| `HIVE_USAGE` | No | Whether usage reporting for the GraphQL API to Hive is enabled | `1` (enabled) or `0` (disabled) | +| `HIVE_USAGE_TARGET` | No (**Yes** if `HIVE` is set to `1`) | The target to which the usage data should be reported | `the-guild/graphql-hive/development` | +| `HIVE_USAGE_ACCESS_TOKEN` | No (**Yes** if `HIVE` is set to `1`) | The internal endpoint key. | `iliketurtles` | +| `HIVE_USAGE_ENDPOINT` | No | The endpoint used for usage reporting. | `http://app.graphql-hive.com/usage` (default value) | diff --git a/packages/services/server/src/environment.ts b/packages/services/server/src/environment.ts index 3e732dbeb9e..5ada401dab5 100644 --- a/packages/services/server/src/environment.ts +++ b/packages/services/server/src/environment.ts @@ -452,11 +452,13 @@ export const env = { kv: cdnCf.CDN_CF_KV_BASE_URL ? { baseUrl: cdnCf.CDN_CF_KV_BASE_URL } : null, } : null, - api: cdnApi.CDN_API === '1' - ? { - baseUrl: cdnApi.CDN_API_BASE_URL, - kv: cdnApi.CDN_API_KV_BASE_URL ? { baseUrl: cdnApi.CDN_API_KV_BASE_URL } : null, - } : null, + api: + cdnApi.CDN_API === '1' + ? { + baseUrl: cdnApi.CDN_API_BASE_URL, + kv: cdnApi.CDN_API_KV_BASE_URL ? { baseUrl: cdnApi.CDN_API_KV_BASE_URL } : null, + } + : null, }, }, s3: { From 23c48d9cb69b6136f528883d279724cf8f686905 Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Wed, 5 Nov 2025 20:13:04 +0100 Subject: [PATCH 10/11] Apply suggestion from @n1ru4l --- .changeset/silly-kiwis-count.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/silly-kiwis-count.md b/.changeset/silly-kiwis-count.md index 1e44e535b84..1d222623991 100644 --- a/.changeset/silly-kiwis-count.md +++ b/.changeset/silly-kiwis-count.md @@ -1,5 +1,5 @@ --- -'hive': major +'hive': minor --- Add envs for KV namespace on Cloudflare CDN worker From 24c604ab9c09a789aee9aaafdc3071f8fb1866b6 Mon Sep 17 00:00:00 2001 From: Guilherme Ananias Date: Wed, 5 Nov 2025 21:20:14 -0300 Subject: [PATCH 11/11] fix: revert changes on Cargo.lock --- configs/cargo/Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/cargo/Cargo.lock b/configs/cargo/Cargo.lock index b68a30bf433..0dcadde5707 100644 --- a/configs/cargo/Cargo.lock +++ b/configs/cargo/Cargo.lock @@ -2604,7 +2604,7 @@ dependencies = [ [[package]] name = "hive-apollo-router-plugin" -version = "2.3.1" +version = "2.3.0" dependencies = [ "anyhow", "apollo-router", @@ -2638,7 +2638,7 @@ dependencies = [ [[package]] name = "hive-console-sdk" -version = "0.1.0" +version = "0.0.1" dependencies = [ "anyhow", "async-trait",