-
Notifications
You must be signed in to change notification settings - Fork 32
docs: Clarify .env file scope in Flash documentation #562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,16 +57,20 @@ Instead of using `flash login`, you can set your API key directly as an environm | |
| export RUNPOD_API_KEY=your_api_key_here | ||
| ``` | ||
|
|
||
| Or add it to your project's `.env` file: | ||
| Or add it to your project's `.env` file for local CLI use: | ||
|
|
||
| ```bash | ||
| RUNPOD_API_KEY=your_api_key_here | ||
| ``` | ||
|
|
||
| You can generate an API key with the correct permissions from [Settings > API Keys](https://www.runpod.io/console/user/settings) in the Runpod console. | ||
| Generate an API key from [Settings > API Keys](https://www.runpod.io/console/user/settings) in the Runpod console. | ||
|
|
||
| <Warning> | ||
| Your Runpod API key needs **All** access permissions to your Runpod account. | ||
| Values in your `.env` file are only used for local CLI commands and development. They are **not** passed to deployed endpoints. To set environment variables on deployed endpoints, use the `env` parameter in your endpoint configuration. See [Endpoint parameters](/flash/configuration/parameters#env) for details. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Citation: Based on PR #39 which clarifies that |
||
| </Warning> | ||
|
|
||
| <Warning> | ||
| Your Runpod API key needs **All** access permissions. | ||
| </Warning> | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -282,6 +282,24 @@ async def load_model(): | |
| ... | ||
| ``` | ||
|
|
||
| <Warning> | ||
| Values in your project's `.env` file are only available locally for CLI commands and development. They are **not** passed to deployed endpoints. You must declare environment variables explicitly using the `env` parameter. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Citation: Based on PR #39 which documents the pattern |
||
| </Warning> | ||
|
|
||
| To pass a local environment variable to your deployed endpoint, read it from `os.environ`: | ||
|
|
||
| ```python | ||
| import os | ||
|
|
||
| @Endpoint( | ||
| name="ml-worker", | ||
| gpu=GpuGroup.ANY, | ||
| env={"HF_TOKEN": os.environ["HF_TOKEN"]} # Read from local env, pass to workers | ||
| ) | ||
| async def load_model(): | ||
| ... | ||
| ``` | ||
|
|
||
| <Note> | ||
| Environment variables are excluded from configuration hashing. Changing environment values won't trigger endpoint recreation, making it easy to rotate API keys. | ||
| </Note> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,19 +82,29 @@ RUNPOD_API_KEY environment variable is required but not set | |
|
|
||
| 1. Generate an API key from [Settings > API Keys](https://www.runpod.io/console/user/settings) in the Runpod console. The key needs **All** access permissions. | ||
|
|
||
| 2. Set the key using one of these methods: | ||
| 2. Authenticate using one of these methods: | ||
|
|
||
| **Option 1: Environment variable** | ||
| **Option 1: Use `flash login` (recommended)** | ||
| ```bash | ||
| flash login | ||
| ``` | ||
| Opens your browser for authentication and saves your credentials. | ||
|
|
||
| **Option 2: Environment variable** | ||
| ```bash | ||
| export RUNPOD_API_KEY="your_api_key" | ||
| ``` | ||
|
|
||
| **Option 2: .env file in your project root** | ||
| **Option 3: .env file for local CLI use** | ||
| ```bash | ||
| echo "RUNPOD_API_KEY=your_api_key" > .env | ||
| ``` | ||
|
|
||
| **Option 3: Add to your shell profile (`~/.bashrc` or `~/.zshrc`) for global authorization** | ||
| <Note> | ||
| Values in your `.env` file are only available locally for CLI commands. They are not passed to deployed endpoints. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Citation: Based on PR #39 which recommends |
||
| </Note> | ||
|
|
||
| **Option 4: Shell profile for persistent local access** | ||
| ```bash | ||
| echo 'export RUNPOD_API_KEY="your_api_key"' >> ~/.bashrc | ||
| source ~/.bashrc | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Citation: Based on PR #39 which clarifies
.envscope for local development. Addedflash loginas recommended auth fix per the PR guidance.View source