docs(auth): clarify env-file discovery & recommend#2402
Conversation
|
/gemini summary |
Summary of ChangesThis pull request significantly improves the documentation for the Gemini CLI's authentication process by clarifying how environment variables are discovered and loaded from Highlights
Changelog
Activity
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request clarifies the environment variable discovery process. However, the documentation should explicitly state the precedence between .gemini/.env and .env when both exist in the same directory, and clarify whether the search for .env files stops at the project root or continues to the system root.
|
|
||
| ### Persisting Environment Variables with `.env` Files | ||
|
|
||
| You can create a **`.gemini/.env`** file in your project directory or in your home directory. Creating a plain **`.env`** file also works, but `.gemini/.env` is recommended to keep Gemini variables isolated from other tools. |
There was a problem hiding this comment.
It's recommended to use .gemini/.env to avoid conflicts with other tools. However, the documentation doesn't explicitly state what happens if both .gemini/.env and .env exist in the same directory. Clarify the precedence in this scenario to prevent confusion. This is especially important since the warning states that variables are not merged across multiple files.
| 1. Starting in the **current directory** and moving upward toward `/`, for each directory it checks: | ||
| 1. `.gemini/.env` | ||
| 2. `.env` | ||
| 2. If no file is found, it falls back to your **home directory**: | ||
| * `~/.gemini/.env` | ||
| * `~/.env` |
There was a problem hiding this comment.
allenhutchison
left a comment
There was a problem hiding this comment.
Thank you for your contribution. This looks like a valuable addition to our docs. Can you please run npm run preflight to fix the lint issues and then ping me to review again?
|
@allenhutchison fixed the lint issues, please take a look again. |
allenhutchison
left a comment
There was a problem hiding this comment.
Looks great thank you for your contribution.
TLDR
.gemini/.envlocation (project or home dir) and note that plain.envalso worksDive Deeper
Reviewer Test Plan
Testing Matrix
Linked issues / bugs
Fixes: #2262