revert(core): support custom base URL via env vars#23976
Conversation
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 reverts the changes introduced in PR #21561. The goal is to rely on the native support provided by the @google/genai SDK for configuring base URLs via environment variables. By removing the custom validation layer, the CLI becomes more flexible and compatible with various proxy configurations that were previously incorrectly restricted. 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 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 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. Footnotes
|
|
Size Change: -778 B (0%) Total Size: 26.4 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request simplifies the content generator by removing the fallback logic for GOOGLE_GEMINI_BASE_URL and GOOGLE_VERTEX_BASE_URL environment variables, along with the validateBaseUrl utility and its associated tests. The createContentGenerator function now exclusively uses the baseUrl provided in the configuration object. I have no feedback to provide.
4859b81 to
b072b71
Compare
|
allowing http on non-localhost was a good change, thanks! This is useful in container environments where you want to reach the proxy though a virtual network where the domain name is not always localhost. |
Summary
Reverts PR #21561. The
@google/genaiSDK inherently supports setting thebaseUrlvia theGOOGLE_GEMINI_BASE_URLandGOOGLE_VERTEX_BASE_URLenvironment variables. The custom environment variable parsing and validation logic introduced in PR #21561 is duplicative and overly restrictive (blocking valid enterprise proxies that use HTTP).Details
Prior to PR #21561, the CLI's initialization pattern initialized the
GoogleGenAIclass without passing an explicithttpOptions.baseUrl(unlessconfig.baseUrlwas configured explicitly). Because no explicit URL was provided to the constructor, the SDK automatically inherited and applied these environment variables natively. Reverting this returns the CLI to rely on the SDK's native environment variable parsing.Related Issues
Reverts #21561
Fixes #6746 (Historically)
How to Validate
npm run buildGOOGLE_GEMINI_BASE_URL=http://localhost:8080 GEMINI_API_KEY=test npm starthttp://localhost:8080.Pre-Merge Checklist