Skip to content

Conversation

@noghartt
Copy link
Contributor

@noghartt noghartt commented Oct 30, 2025

Background

Fix #7036
Closes #7213

This PR adds a new env for KV_BASE_URL which will let both CF CDN worker + API custom providers work on self-hosted setup for CDN.

Also, it adds a guarantee that it won't create any breaking change considering the old value.

Description

We changed these services:

  • package/services/cdn-worker: add a new env KV_BASE_URL + expose a new field on function createIsKeyValid to let the user pass any string value to be used by artifact handler.
  • Fix packages/services/server to, when using API provider for CDN, it let the user insert any KV, for compatibility with their setup (if on self-hosted).

Checklist

  • System configuration

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @noghartt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the CDN worker and server configurations by introducing a new KV_BASE_URL environment variable. This allows self-hosted instances to specify a custom base URL for their Key-Value (KV) storage, improving flexibility for CDN providers (both Cloudflare worker and API-based). The changes are designed to be fully backward compatible, ensuring a smooth transition for existing deployments while expanding customization options for KV storage access.

Highlights

  • New KV Base URL Environment Variable: Introduced KV_STORAGE_BASE_URL for the CDN worker to allow custom KV storage endpoints.
  • Self-Hosted CDN Compatibility: Enables both Cloudflare CDN worker and API custom providers to work with self-hosted KV storage setups.
  • Backward Compatibility: Ensures that the changes do not introduce breaking changes for existing configurations.
  • Configurable Key Validation: The createIsKeyValid function now accepts an optional kvStorageBaseUrl to fetch schemas from a specified KV storage.
  • Server-Side Configuration: Added CDN_API_KV_BASE_URL and CDN_CF_KV_BASE_URL environment variables to the server for configuring KV base URLs for API and Cloudflare CDN providers, respectively.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a KV_BASE_URL environment variable for the CDN worker to allow custom KV storage endpoints, which is particularly useful for self-hosted setups. The changes span across the CDN worker and the server packages, adding the necessary configuration, type definitions, and logic to use the new variable while maintaining backward compatibility with a default URL.

My review has identified a critical syntax error that needs to be fixed, along with some medium-severity issues related to documentation accuracy, code maintainability (magic strings), and typos in comments. Overall, the changes are well-structured and address the intended feature.

noghartt and others added 3 commits October 30, 2025 15:55
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@n1ru4l
Copy link
Contributor

n1ru4l commented Oct 31, 2025

As a general question: what are the implications if you deploy this to your own cloudflare, with https://key-cache.graphql-hive.com hardcoded?

@noghartt
Copy link
Contributor Author

As a general question: what are the implications if you deploy this to your own cloudflare, with https://key-cache.graphql-hive.com hardcoded?

From the tests I did in my self-hosted solution, it didn't work. So what I did was changing it in a similar way I did on this PR (without the conditional).

But not sure if you guys are using this URL for the caching yet or there's something new, I left it as the fallback, just in case to avoid any breaking change (even because there's a usage of it on the server).

@n1ru4l
Copy link
Contributor

n1ru4l commented Nov 3, 2025

From the tests I did in my self-hosted solution, it didn't work. So what I did was changing it in a similar way I did on this PR (without the conditional).

Did you receive errors or did the caching just not work?

@noghartt noghartt requested a review from n1ru4l November 3, 2025 12:57
@noghartt
Copy link
Contributor Author

noghartt commented Nov 3, 2025

From the tests I did in my self-hosted solution, it didn't work. So what I did was changing it in a similar way I did on this PR (without the conditional).

Did you receive errors or did the caching just not work?

The caching just didn't work, from what I tested. Since I deployed my own CF Worker + KV Namespace, it worked fine.

@n1ru4l
Copy link
Contributor

n1ru4l commented Nov 4, 2025

@noghartt Can you also add a changeset using pnpm changeset for hive?

Also there are some formatting issues: https://github.com/graphql-hive/console/actions/runs/19064830441/job/54452786353

@noghartt
Copy link
Contributor Author

noghartt commented Nov 5, 2025

@noghartt Can you also add a changeset using pnpm changeset for hive?

Also there are some formatting issues: https://github.com/graphql-hive/console/actions/runs/19064830441/job/54452786353

Hey @n1ru4l, pushed both commits with the lint fixes + the changeset. Can you just doublecheck the changeset, not sure if is all good on that.

BTW, do you think that a CONTRIBUTING.md following those good practices like running the changeset does make sense for those cases?

Copy link
Contributor

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@n1ru4l
Copy link
Contributor

n1ru4l commented Nov 5, 2025

@noghartt having a CONTRIBUTING.md is a good idea, I would keep it for another PR though!

@noghartt noghartt requested a review from n1ru4l November 6, 2025 00:22
@noghartt
Copy link
Contributor Author

noghartt commented Nov 6, 2025

See #7202 (comment)

Pushed a commit rollback the changes!

Copy link
Contributor

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@n1ru4l n1ru4l enabled auto-merge (squash) November 6, 2025 08:08
@n1ru4l n1ru4l merged commit 0885253 into graphql-hive:main Nov 6, 2025
43 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Self-hosted CDN worker should have an env for KV cache URL (CloudFlare R2)

2 participants