feat: add API endpoint override for reverse proxy deployments#871
feat: add API endpoint override for reverse proxy deployments#871tasuku43 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 9252d42 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
b681e42 to
9252d42
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces an opt-in API endpoint base URL override via the GOOGLE_WORKSPACE_CLI_API_ENDPOINT_BASE_URL environment variable. This allows routing Discovery-driven Google API requests through an internal reverse proxy or API gateway by rewriting the scheme, host, and port of the API URLs while preserving their paths. The changes include documentation updates, environment variable handling, URL rewriting logic in discovery.rs, and comprehensive unit tests. Additionally, a minor refactoring was done in script.rs to simplify JSON file matching. There are no review comments, so we have no feedback to provide.
Summary of ChangesHello, 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 introduces a new feature allowing users to override the base URL for Google API requests via an environment variable. This is particularly useful for deployments that route API calls through an internal reverse proxy or API gateway. The implementation intelligently rewrites only the origin (scheme, host, port) of API endpoints derived from Discovery documents, ensuring that Google API paths remain intact and Discovery caching behavior is preserved. Highlights
Using Gemini Code AssistThe 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
Customization To customize the 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 Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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. Footnotes
|
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Description
Add an opt-in API endpoint base URL override via
GOOGLE_WORKSPACE_CLI_API_ENDPOINT_BASE_URLfor deployments that route Google API calls through an internal reverse proxy or API gateway.The implementation rewrites only the scheme, host, and port of Discovery-derived
rootUrlandbaseUrl, preserving Google API paths. Discovery documents are still fetched directly from Google, and cached Discovery JSON remains the original Google document so the override can be enabled or disabled without clearing the cache.This is separate from standard
http_proxy/https_proxyforward proxy support: those configure transport proxying, while this configures the API endpoint origin. Existing authentication behavior is unchanged, and OAuth authorization/token endpoints are not rewritten.Notes:
GOOGLE_WORKSPACE_CLI_API_ENDPOINT_BASE_URLis ignored for routing purposes; the Google API path from Discovery is preserved./v1beta/. Proxies that route only by path may need their own disambiguation rules for those services.script.rsrequired by the current stable toolchain.Dry Run Output:
N/A. This PR does not add a new command or request body; it changes the base URL used for existing Discovery-driven API requests.
Checklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.Testing
cargo fmtcargo buildcargo clippy -- -D warningscargo test