-
Notifications
You must be signed in to change notification settings - Fork 616
Description
Title
Add .env.example templates + update sample READMEs to use safe secret setup
Summary
Several samples in this repo instruct users to create a .env file containing API keys (e.g., GEMINI_API_KEY) but the repo does not provide any .env.example / template files. This encourages insecure “copy/paste” workflows and increases the risk of accidentally committing real secrets.
Problem
Today, multiple sample READMEs tell developers to do things like:
echo "GEMINI_API_KEY=..." > .envexport GEMINI_API_KEY=...and/or append to.env
…but there is no corresponding template file (.env.example, .env.local.example, etc.) that:
- documents required env vars,
- distinguishes placeholders vs real secrets,
- standardizes setup with
cp .env.example .env.
This is especially risky in a reference repo because users tend to treat it as “best practice”.
Why this matters (security + developer experience)
- Reduces accidental secret leakage (commits, screenshots, copy/paste into tickets)
- Sets a strong precedent for credential hygiene in sample code
- Makes onboarding faster and more consistent
Proposed change
-
Add
.env.example(or.env.local.examplewhere appropriate) to each sample that requires secrets.- Include placeholders + brief comments.
- Example:
# Copy to .env and fill values GEMINI_API_KEY=your_gemini_api_key_here # Optional: # GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here
-
Update sample READMEs to use the standard pattern:
cp .env.example .env # edit .env (do not commit) -
Ensure
.envfiles are ignored repo-wide:-
Add to root
.gitignoreif missing:.env.env.*(optional, depending on conventions)!.env.example(ensure templates are kept)
-
Acceptance criteria
- Every sample that needs an API key has a matching
.env.example(or.env.local.example) committed - All READMEs stop recommending
echo "...=REAL_KEY" > .envand instead recommend copying from the template -
.envis ignored by git while templates remain tracked - Quickstart instructions remain copy/paste friendly
Suggested locations (examples)
samples/agent/...(ADK sample(s) that requireGEMINI_API_KEY)samples/client/...(Angular / other client samples)- Any other sample folders referencing
*_API_KEY,api_key,GEMINI_API_KEY, etc.
This is standard practice in more mature projects—for example, Vercel’s official Next.js + Supabase example ships a .env.local.example template, and projects like Supabase and n8n include .env.example files as the default onboarding flow for secrets.