-
Notifications
You must be signed in to change notification settings - Fork 10k
fix: token substitution in OPENCODE_CONFIG_CONTENT #13241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: token substitution in OPENCODE_CONFIG_CONTENT #13241
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #13226: fix(config): apply token substitution for OPENCODE_CONFIG_CONTENT This PR appears to be addressing the exact same issue as PR #13241. Both are:
You should review PR #13226 to determine if it's already solving this problem or if there are differences in the approach. |
ee4234f to
3900d68
Compare
|
/review |
|
lgtm |
| if (Flag.OPENCODE_CONFIG_CONTENT) { | ||
| result = mergeConfigConcatArrays(result, JSON.parse(Flag.OPENCODE_CONFIG_CONTENT)) | ||
| if (process.env.OPENCODE_CONFIG_CONTENT) { | ||
| result = mergeConfigConcatArrays(result, await load(process.env.OPENCODE_CONFIG_CONTENT, path.join(Instance.directory, "<inline>"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did u change to process.env for testing purposes?
Also I would prefer not doing this path.join ("") thing. I get why it works but instead we should probably make:
- load accept either a config file or a directory path (using an object param)
- make laod only accept directory paths so it doesnt run path.dirname internally
This would just make things more clear for the future cause it feels like easy footgun as is rn
3900d68 to
08e92d9
Compare
|
@rekram1-node Yes, the switch to using I adjusted the The functionality doesn't seem to have been impacted, though: the changes do continue to achieve the intended result (the sample test commands in the initial comment still works they did in the prior incarnation of the PR). For comparison's sake, the original version of the PR can be seen at ariane-emory#163. What do you think? If you're happier with it this way, then I'll happily bow to your wisdom. |
Route OPENCODE_CONFIG_CONTENT through load() to enable {env:} and {file:}
token substitution. Uses the env var name as the path for clearer error
messages instead of a generic <inline> placeholder.
Fixes anomalyco#13219
|
@rekram1-node An alternative take that takes a middle path by adding some explanatory comments to the earlier version of this PR, mitigating the foot gun while retaining the simplicity of the earlier version if thus PR, can be seen here: ariane-emory#164. Please just let me know take on the issue you like best. :) |
969c291 to
68eb034
Compare
What does this PR do?
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):