refactor(core): resolve database and websearch config through Effect Config

This commit is contained in:
Kit Langton
2026-07-02 09:51:39 -04:00
parent 4045041554
commit 0552458fba
10 changed files with 223 additions and 47 deletions
@@ -18,8 +18,10 @@ const preserveExerciseDatabase = !!process.env.OPENCODE_HTTPAPI_EXERCISE_DB
export const exerciseDatabasePath =
process.env.OPENCODE_HTTPAPI_EXERCISE_DB ??
path.join(process.env.TMPDIR ?? "/tmp", `opencode-httpapi-exercise-${process.pid}.db`)
// Must run before the first Effect Config read anywhere in the process: the
// default ConfigProvider snapshots process.env on first use, so a Config read
// during an earlier module import would freeze the wrong database path.
process.env.OPENCODE_DB = exerciseDatabasePath
Flag.OPENCODE_DB = exerciseDatabasePath
export const original = {
OPENCODE_SERVER_PASSWORD: Flag.OPENCODE_SERVER_PASSWORD,