[PR #13484] fix: token substitution in OPENCODE_CONFIG_CONTENT (redo) #14683

Open
opened 2026-02-16 18:19:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13484

State: open
Merged: No


What does this PR do?

  • Route inline config through load() function to enable {env:} and {file:} token substitution
  • Make OPENCODE_CONFIG_CONTENT a dynamic getter for runtime env var access
  • Add tests for {env:} and {file:} token substitution in OPENCODE_CONFIG_CONTENT

NOTE: This PR injects the scheme value when necessary, so as to avoid the unintended creation of a ./OPENCODE_CONFIG_CONTENT file in the project's root (as was the case in the prior merged PR on this issue, #13384)

Fixes #13219

How did you verify your code works?

Manual testing, bun typecheck, bun test.

You may manually test by running commands akin to the following (assuming bash):

echo "matrix" > /tmp/test-secret.txt 
export MODEL="opencode/big-pickle"
OPENCODE_CONFIG_CONTENT='{"$schema":"https://opencode.ai/config.json","theme":"{file:/tmp/test-secret.txt}", "model":"{env:MODEL}"}' bun dev;
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13484 **State:** open **Merged:** No --- ### What does this PR do? - Route inline config through load() function to enable {env:} and {file:} token substitution - Make OPENCODE_CONFIG_CONTENT a dynamic getter for runtime env var access - Add tests for {env:} and {file:} token substitution in OPENCODE_CONFIG_CONTENT **NOTE:** This PR injects the scheme value when necessary, so as to avoid the unintended creation of a `./OPENCODE_CONFIG_CONTENT` file in the project's root (as was the case in the prior merged PR on this issue, #13384) Fixes #13219 ### How did you verify your code works? Manual testing, `bun typecheck`, `bun test`. You may manually test by running commands akin to the following (assuming bash): ``` echo "matrix" > /tmp/test-secret.txt export MODEL="opencode/big-pickle" OPENCODE_CONFIG_CONTENT='{"$schema":"https://opencode.ai/config.json","theme":"{file:/tmp/test-secret.txt}", "model":"{env:MODEL}"}' bun dev;
yindo added the pull-request label 2026-02-16 18:19:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14683