Skip to content

docs: load README API keys from the environment - #323

Open
illuminati1911 wants to merge 1 commit into
masterfrom
docs/readme-api-key-environment
Open

illuminati1911 wants to merge 1 commit into
masterfrom
docs/readme-api-key-environment

Conversation

@illuminati1911

@illuminati1911 illuminati1911 commented Dec 3, 2026 •

Copy link
Copy Markdown

Issue

The Directions and reverse-geocoding examples pass an API key placeholder directly to maps.WithAPIKey. Replacing it with a real key can put a credential in source control, despite the README's warning to keep it secret.

Fix

Read GOOGLE_MAPS_API_KEY from the environment in both examples and report a missing or empty value before creating the client. Add guidance on restricting the key to the APIs in use and to the server's public egress IP addresses. No SDK code changes.

Verification

go build -mod=readonly ./... passed. The Directions example compiled and rejected missing and empty keys. Both changes rendered in the README.


Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #322 🦕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

README: keep example API keys out of source code

1 participant