Skip to content

Commit e9471a1

Browse files
committed
docs: clarify env placeholder config syntax
1 parent 87a9693 commit e9471a1

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,20 @@ Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-inde
348348
}
349349
```
350350

351+
String values in `codebase-index.json` can reference environment variables with `{env:VAR_NAME}` when the placeholder is the entire string value. Variable names must match `[A-Z_][A-Z0-9_]*`. This is useful for secrets such as custom provider API keys so they do not need to be committed to the config file.
352+
353+
```json
354+
{
355+
"embeddingProvider": "custom",
356+
"customProvider": {
357+
"baseUrl": "{env:EMBED_BASE_URL}",
358+
"model": "nomic-embed-text",
359+
"dimensions": 768,
360+
"apiKey": "{env:EMBED_API_KEY}"
361+
}
362+
}
363+
```
364+
351365
### Options Reference
352366

353367
| Option | Default | Description |
@@ -604,16 +618,16 @@ Works with any server that implements the OpenAI `/v1/embeddings` API format (ll
604618
{
605619
"embeddingProvider": "custom",
606620
"customProvider": {
607-
"baseUrl": "http://localhost:11434/v1",
621+
"baseUrl": "{env:EMBED_BASE_URL}",
608622
"model": "nomic-embed-text",
609623
"dimensions": 768,
610-
"apiKey": "optional-api-key",
624+
"apiKey": "{env:EMBED_API_KEY}",
611625
"maxTokens": 8192,
612626
"timeoutMs": 30000
613627
}
614628
}
615629
```
616-
Required fields: `baseUrl`, `model`, `dimensions` (positive integer). Optional: `apiKey`, `maxTokens`, `timeoutMs` (default: 30000).
630+
Required fields: `baseUrl`, `model`, `dimensions` (positive integer). Optional: `apiKey`, `maxTokens`, `timeoutMs` (default: 30000). `{env:VAR_NAME}` placeholders are resolved before config validation for fields that are actually used and throw if the referenced environment variable is missing or malformed.
617631

618632
## ⚠️ Tradeoffs
619633

0 commit comments

Comments
 (0)