docs: clarify where secrets can be templated from (#11865)
* docs: clarify where secrets are resolved from and IDE vs CLI differences Reorganizes the secrets FAQ to lead with how to use secrets, then clearly lists the resolution order. Adds a warning that IDE extensions cannot read shell environment variables — the most common source of confusion. Fixes #9081 * Use Mintlify <Warning> component instead of :::warning syntax --------- Co-authored-by: continue[bot] <230936708+continue[bot]@users.noreply.github.com>
This commit is contained in:
parent
5f3a861a59
commit
03c8f952e8
2 changed files with 34 additions and 47 deletions
|
|
@ -270,59 +270,44 @@ If you're getting parse errors with remote Ollama:
|
|||
|
||||
For running Continue completely offline without internet access, see the [Running Continue Without Internet guide](/guides/running-continue-without-internet).
|
||||
|
||||
Continue supports multiple methods for managing secrets locally, searched in this order:
|
||||
#### How to reference secrets in config.yaml
|
||||
|
||||
1. **Workspace `.env` files**: Place a `.env` file in your workspace root directory
|
||||
2. **Workspace Continue folder**: Place a `.env` file in `<workspace-root>/.continue/.env`
|
||||
3. **Global `.env` file**: Place a `.env` file in `~/.continue/.env` for user-wide secrets
|
||||
4. **Process environment variables**: Use standard system environment variables
|
||||
Use the `${{ secrets.SECRET_NAME }}` syntax anywhere in your `config.yaml`:
|
||||
|
||||
#### Creating `.env` files
|
||||
|
||||
Create a `.env` file in one of these locations:
|
||||
- **Per-workspace**: `<workspace-root>/.env` or `<workspace-root>/.continue/.env`
|
||||
- **Global**: `~/.continue/.env`
|
||||
|
||||
Example `.env` file:
|
||||
```
|
||||
OPENAI_API_KEY=sk-...
|
||||
ANTHROPIC_API_KEY=sk-ant-...
|
||||
CUSTOM_API_URL=https://api.example.com
|
||||
```
|
||||
|
||||
#### Using secrets in config.yaml
|
||||
|
||||
Reference your local secrets using the `secrets` namespace:
|
||||
```yaml
|
||||
models:
|
||||
- provider: openai
|
||||
apiKey: ${{ secrets.OPENAI_API_KEY }}
|
||||
```
|
||||
|
||||
#### Mission Control-managed secrets
|
||||
#### Where secrets are resolved from
|
||||
|
||||
For centralized team secret management, use `${{ inputs.SECRET_NAME }}` syntax in your config.yaml and manage them at [https://continue.dev/settings/secrets](https://continue.dev/settings/secrets):
|
||||
```yaml
|
||||
models:
|
||||
- provider: openai
|
||||
apiKey: ${{ inputs.OPENAI_API_KEY }}
|
||||
When Continue encounters `${{ secrets.X }}`, it searches these sources **in order**:
|
||||
|
||||
1. **Workspace `.env` file**: `<workspace-root>/.env`
|
||||
2. **Workspace Continue `.env` file**: `<workspace-root>/.continue/.env`
|
||||
3. **Global `.env` file**: `~/.continue/.env`
|
||||
4. **Process environment variables**: Standard system environment variables
|
||||
|
||||
<Warning>
|
||||
**IDE extensions (VS Code, JetBrains) cannot read your shell environment variables.** Setting `export OPENAI_API_KEY=...` in your terminal will not make the key available to Continue running inside your IDE. You must use a `.env` file instead.
|
||||
|
||||
Process environment variables (source 4) only work with the [Continue CLI](/cli/configuration), where you can pass them directly: `export OPENAI_API_KEY=sk-... && cn`
|
||||
</Warning>
|
||||
|
||||
#### Creating `.env` files
|
||||
|
||||
Create a `.env` file in one of the locations above. Use standard dotenv format:
|
||||
|
||||
```
|
||||
OPENAI_API_KEY=sk-...
|
||||
ANTHROPIC_API_KEY=sk-ant-...
|
||||
CUSTOM_API_URL=https://api.example.com
|
||||
```
|
||||
|
||||
#### Important notes
|
||||
|
||||
- **Never commit `.env` files** to version control - add them to `.gitignore`
|
||||
- The `.env` file uses standard dotenv format (KEY=value, no quotes needed)
|
||||
- Secrets are loaded when Continue starts, so restart your IDE after changes
|
||||
- Local `.env` files take precedence over Hub secrets when both exist
|
||||
|
||||
#### Troubleshooting secrets
|
||||
|
||||
If your API keys aren't being recognized:
|
||||
1. Check the `.env` file is in the correct location
|
||||
2. Ensure there are no quotes around values in the `.env` file
|
||||
3. Restart your IDE after adding/changing secrets
|
||||
4. Verify the variable name matches exactly (case-sensitive)
|
||||
5. Check that your `.env` file has proper line endings (LF, not CRLF on Windows)
|
||||
- **Never commit `.env` files** to version control — add them to `.gitignore`
|
||||
- No quotes around values
|
||||
- Restart your IDE after adding or changing secrets
|
||||
|
||||
### Using Model Addons Locally
|
||||
|
||||
|
|
|
|||
|
|
@ -95,18 +95,20 @@ On Mission Control, you can configure secrets when adding a model or MCP server.
|
|||
|
||||
This will use mustache notation to pass the secret, eg `${{ secrets.SECRET_NAME }}`
|
||||
|
||||
When configuring a local model or MCP server, you can use the same mustache notation for secrets which read from:
|
||||
When configuring a local model or MCP server, you can use the same mustache notation for secrets which are resolved from these sources in order:
|
||||
|
||||
<Columns cols={2}>
|
||||
<Card title="Workspace" icon="folder-open">
|
||||
`.env` file at your project root, or in `<workspace-root>/.continue/.env`
|
||||
</Card>
|
||||
|
||||
<Card title="Global" icon="globe">
|
||||
`.env` file in `~/.continue/.env`
|
||||
</Card>
|
||||
|
||||
<Card title="Workspace" icon="folder-open">
|
||||
`.env` file at your project root
|
||||
</Card>
|
||||
</Columns>
|
||||
|
||||
See [Managing Local Secrets and Environment Variables](/faqs#managing-local-secrets-and-environment-variables) for full details on secret resolution and IDE vs CLI differences.
|
||||
|
||||
<Info>
|
||||
**When to use `secrets.` vs `inputs.`**
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue