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

Skip to content

Commit a361673

Browse files
authored
fix: Include 'CODER' env var prefix on group mappings (coder#7015)
* fix: Include 'CODER' env var prefix on group mappings * Unit test to force CODER prefix
1 parent 00d468b commit a361673

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

codersdk/deployment_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package codersdk_test
22

33
import (
4+
"strings"
45
"testing"
56

67
"github.com/stretchr/testify/require"
@@ -101,6 +102,12 @@ func TestDeploymentValues_HighlyConfigurable(t *testing.T) {
101102
t.Errorf("Option %q is excluded but has an env name", opt.Name)
102103
}
103104

105+
// Also check all env vars are prefixed with CODER_
106+
const prefix = "CODER_"
107+
if opt.Env != "" && !strings.HasPrefix(opt.Env, prefix) {
108+
t.Errorf("Option %q has an env name (%q) that is not prefixed with %s", opt.Name, opt.Env, prefix)
109+
}
110+
104111
delete(excludes, opt.Name)
105112
}
106113

0 commit comments

Comments
 (0)