File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 11export 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" )
Original file line number Diff line number Diff 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
6682The config file has a schema that's defined in [ ** ` opencode.ai/config.json ` ** ] ( https://opencode.ai/config.json ) .
You can’t perform that action at this time.
0 commit comments