Skip to content

Commit 62f7da5

Browse files
authored
Merge branch 'dev' into feat/python_sdk
2 parents ddc03b3 + eb398f1 commit 62f7da5

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

packages/opencode/src/config/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ export namespace Config {
6161
)),
6262
]
6363

64+
if (Flag.OPENCODE_CONFIG_DIR) {
65+
directories.push(Flag.OPENCODE_CONFIG_DIR)
66+
log.debug("loading config from OPENCODE_CONFIG_DIR", { path: Flag.OPENCODE_CONFIG_DIR })
67+
}
68+
6469
for (const dir of directories) {
6570
await assertValid(dir)
6671
installDependencies(dir)

packages/opencode/src/flag/flag.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export namespace Flag {
22
export const OPENCODE_AUTO_SHARE = truthy("OPENCODE_AUTO_SHARE")
33
export const OPENCODE_CONFIG = process.env["OPENCODE_CONFIG"]
4+
export const OPENCODE_CONFIG_DIR = process.env["OPENCODE_CONFIG_DIR"]
45
export const OPENCODE_CONFIG_CONTENT = process.env["OPENCODE_CONFIG_CONTENT"]
56
export const OPENCODE_DISABLE_AUTOUPDATE = truthy("OPENCODE_DISABLE_AUTOUPDATE")
67
export const OPENCODE_DISABLE_PRUNE = truthy("OPENCODE_DISABLE_PRUNE")

packages/web/src/content/docs/config.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,22 @@ opencode run "Hello world"
6161

6262
---
6363

64+
### Custom directory
65+
66+
You can specify a custom config directory using the `OPENCODE_CONFIG_DIR`
67+
environment variable. This directory will be searched for agents, commands,
68+
modes, and plugins just like the standard `.opencode` directory, and should
69+
follow the same structure.
70+
71+
```bash
72+
export OPENCODE_CONFIG_DIR=/path/to/my/config-directory
73+
opencode run "Hello world"
74+
```
75+
76+
Note: The custom directory is loaded after the global config and `.opencode` directories, so it can override their settings.
77+
78+
---
79+
6480
## Schema
6581

6682
The config file has a schema that's defined in [**`opencode.ai/config.json`**](https://opencode.ai/config.json).

0 commit comments

Comments
 (0)