- Notifications
You must be signed in to change notification settings - Fork926
feat(agent/agentcontainers): add feature options as envs#18576
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
feat(agent/agentcontainers): add feature options as envs#18576
Conversation
// OptionsAsEnvs converts the DevcontainerFeatures into a list of | ||
// environment variables that can be used to set feature options. | ||
// The format is FEATURE_<FEATURE_NAME>_<OPTION_NAME>=<value>. | ||
// For example, if the feature is: | ||
// | ||
//"ghcr.io/coder/devcontainer-features/code-server:1": { | ||
// "port": 9090, | ||
// } | ||
// | ||
// It will produce: | ||
// | ||
//FEATURE_CODE_SERVER_PORT=9090 |
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.
I can foresee an issuepotentially arising with this approach.
"go": { "server-port": 9090},"go-server": { "port": 9091}
Would both produceFEATURE_GO_SERVER_PORT
but they have different values
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.
yeah we might want something likeFEATURE__GO_SERVER__PORT
/FEATURE__GO__SERVER_PORT
edit: jinx 😄
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.
Good call-out, not sure how we should fix though. Use__
as separator? Include the:1
as_1
?
DanielleMaywoodJun 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
I think__
could work as a separator, it might still have the same issue if people want to double up on their-
but I think that is unlikely.
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.
Seems we had the same idea@johnstcn, let's go with__
although using_OPTION_
might also work. LikeFEATURE_GO_SERVER_OPTION_PORT
. The risk of collision is so small that if it does happen, somebody can think about why they chose to call an option option.
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.
I think double-underscore separator should work fine.
edit: jinx again, but I do like your OPTION_OPTION as well!
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.
Unless you guys are greatly opposed I'd actually like to go with the_OPTION_
approach. Seems more human friendly.
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.
@mafredri I prefer your suggestion, go with_OPTION_
.
3c4d920
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Since
devcontainer-feature.json
does not support referencing options anywhere outside the feature installation, especially within the JSON itself, this change implements a work-around by defining environment variables based on the feature options that we can use in our features.This allows us to define a dynamic URL for e.g. the
code-server
feature.