feat(samples/kotlin): support GRID_API_BASE_URL override#589
Open
pengying wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Contributor
Author
This was referenced Jun 16, 2026
Contributor
|
|
||
| // Optional override for the Grid API base URL (e.g. a dev/RC environment). | ||
| // When unset, the SDK uses its default (production) base URL. | ||
| val apiBaseUrl: String? = getEnvVarOrNull("GRID_API_BASE_URL") |
Contributor
There was a problem hiding this comment.
Empty string not treated as "unset"
getEnvVarOrNull returns an empty string if GRID_API_BASE_URL is set to "" (e.g. an accidentally blank .env entry). That empty string is non-null, so apiBaseUrl will be "" and baseUrl("") will be called on the SDK builder — almost certainly producing a malformed URL at runtime instead of silently falling back to the default.
Suggested change
| val apiBaseUrl: String? = getEnvVarOrNull("GRID_API_BASE_URL") | |
| val apiBaseUrl: String? = getEnvVarOrNull("GRID_API_BASE_URL")?.takeIf { it.isNotBlank() } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: samples/kotlin/src/main/kotlin/com/grid/sample/Config.kt
Line: 18
Comment:
**Empty string not treated as "unset"**
`getEnvVarOrNull` returns an empty string if `GRID_API_BASE_URL` is set to `""` (e.g. an accidentally blank `.env` entry). That empty string is non-null, so `apiBaseUrl` will be `""` and `baseUrl("")` will be called on the SDK builder — almost certainly producing a malformed URL at runtime instead of silently falling back to the default.
```suggestion
val apiBaseUrl: String? = getEnvVarOrNull("GRID_API_BASE_URL")?.takeIf { it.isNotBlank() }
```
How can I resolve this? If you propose a fix, please make it concise.Add an optional GRID_API_BASE_URL environment variable so the Kotlin sample can target a non-production Grid API base path (e.g. a dev/RC environment). When unset, the SDK's default base URL is used. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
cc1024a to
f206e35
Compare
This was referenced Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add an optional GRID_API_BASE_URL environment variable so the Kotlin
sample can target a non-production Grid API base path (e.g. a dev/RC
environment). When unset, the SDK's default base URL is used.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com