Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0602b0f

Browse files
committed
_OPTION_
1 parent 4df9fe6 commit 0602b0f

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

agent/agentcontainers/api_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,8 +2152,8 @@ func TestAPI(t *testing.T) {
21522152
assert.Contains(t, envs, "CODER_WORKSPACE_OWNER_NAME=test-user")
21532153
assert.Contains(t, envs, "CODER_URL=test-subagent-url")
21542154
// First call should not have feature envs.
2155-
assert.NotContains(t, envs, "FEATURE_CODE_SERVER_PORT=9090")
2156-
assert.NotContains(t, envs, "FEATURE_DOCKER_IN_DOCKER_MOBY=false")
2155+
assert.NotContains(t, envs, "FEATURE_CODE_SERVER_OPTION_PORT=9090")
2156+
assert.NotContains(t, envs, "FEATURE_DOCKER_IN_DOCKER_OPTION_MOBY=false")
21572157
return nil
21582158
})
21592159

@@ -2163,8 +2163,8 @@ func TestAPI(t *testing.T) {
21632163
assert.Contains(t, envs, "CODER_WORKSPACE_OWNER_NAME=test-user")
21642164
assert.Contains(t, envs, "CODER_URL=test-subagent-url")
21652165
// Second call should have feature envs from the first config read.
2166-
assert.Contains(t, envs, "FEATURE_CODE_SERVER_PORT=9090")
2167-
assert.Contains(t, envs, "FEATURE_DOCKER_IN_DOCKER_MOBY=false")
2166+
assert.Contains(t, envs, "FEATURE_CODE_SERVER_OPTION_PORT=9090")
2167+
assert.Contains(t, envs, "FEATURE_DOCKER_IN_DOCKER_OPTION_MOBY=false")
21682168
return nil
21692169
})
21702170

agent/agentcontainers/devcontainercli.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type DevcontainerFeatures map[string]any
4040

4141
// OptionsAsEnvs converts the DevcontainerFeatures into a list of
4242
// environment variables that can be used to set feature options.
43-
// The format is FEATURE_<FEATURE_NAME>_<OPTION_NAME>=<value>.
43+
// The format is FEATURE_<FEATURE_NAME>_OPTION_<OPTION_NAME>=<value>.
4444
// For example, if the feature is:
4545
//
4646
// "ghcr.io/coder/devcontainer-features/code-server:1": {
@@ -49,7 +49,7 @@ type DevcontainerFeatures map[string]any
4949
//
5050
// It will produce:
5151
//
52-
// FEATURE_CODE_SERVER_PORT=9090
52+
// FEATURE_CODE_SERVER_OPTION_PORT=9090
5353
//
5454
// Note that the feature name is derived from the last part of the key,
5555
// so "ghcr.io/coder/devcontainer-features/code-server:1" becomes
@@ -71,7 +71,7 @@ func (f DevcontainerFeatures) OptionsAsEnvs() []string {
7171
k = strings.ReplaceAll(k, "-", "_")
7272
for k2, v2 := range vv {
7373
k2 = strings.ReplaceAll(k2, "-", "_")
74-
env = append(env, fmt.Sprintf("FEATURE_%s_%s=%s", strings.ToUpper(k), strings.ToUpper(k2), fmt.Sprintf("%v", v2)))
74+
env = append(env, fmt.Sprintf("FEATURE_%s_OPTION_%s=%s", strings.ToUpper(k), strings.ToUpper(k2), fmt.Sprintf("%v", v2)))
7575
}
7676
}
7777
slices.Sort(env)

agent/agentcontainers/devcontainercli_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ func TestDevcontainerFeatures_OptionsAsEnvs(t *testing.T) {
672672
},
673673
},
674674
want: []string{
675-
"FEATURE_CODE_SERVER_PORT=9090",
675+
"FEATURE_CODE_SERVER_OPTION_PORT=9090",
676676
},
677677
},
678678
{
@@ -683,7 +683,7 @@ func TestDevcontainerFeatures_OptionsAsEnvs(t *testing.T) {
683683
},
684684
},
685685
want: []string{
686-
"FEATURE_DOCKER_IN_DOCKER_MOBY=false",
686+
"FEATURE_DOCKER_IN_DOCKER_OPTION_MOBY=false",
687687
},
688688
},
689689
{
@@ -699,10 +699,10 @@ func TestDevcontainerFeatures_OptionsAsEnvs(t *testing.T) {
699699
},
700700
},
701701
want: []string{
702-
"FEATURE_CODE_SERVER_PASSWORD=secret",
703-
"FEATURE_CODE_SERVER_PORT=9090",
704-
"FEATURE_DOCKER_IN_DOCKER_DOCKER_DASH_COMPOSE_VERSION=v2",
705-
"FEATURE_DOCKER_IN_DOCKER_MOBY=false",
702+
"FEATURE_CODE_SERVER_OPTION_PASSWORD=secret",
703+
"FEATURE_CODE_SERVER_OPTION_PORT=9090",
704+
"FEATURE_DOCKER_IN_DOCKER_OPTION_DOCKER_DASH_COMPOSE_VERSION=v2",
705+
"FEATURE_DOCKER_IN_DOCKER_OPTION_MOBY=false",
706706
},
707707
},
708708
{
@@ -714,15 +714,15 @@ func TestDevcontainerFeatures_OptionsAsEnvs(t *testing.T) {
714714
"./invalid-feature": "not-a-map",
715715
},
716716
want: []string{
717-
"FEATURE_CODE_SERVER_PORT=9090",
717+
"FEATURE_CODE_SERVER_OPTION_PORT=9090",
718718
},
719719
},
720720
{
721721
name: "real config example",
722722
features: realConfig.MergedConfiguration.Features,
723723
want: []string{
724-
"FEATURE_CODE_SERVER_PORT=9090",
725-
"FEATURE_DOCKER_IN_DOCKER_MOBY=false",
724+
"FEATURE_CODE_SERVER_OPTION_PORT=9090",
725+
"FEATURE_DOCKER_IN_DOCKER_OPTION_MOBY=false",
726726
},
727727
},
728728
{

0 commit comments

Comments
 (0)