File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ import (
1010 "testing"
1111
1212 "go.jetpack.io/devbox/internal/build"
13- "go.jetpack.io/devbox/internal/envir"
1413)
1514
15+ const envNamePrefix = "DEVBOX_FEATURE_"
16+
1617type feature struct {
1718 name string
1819 enabled bool
@@ -48,7 +49,7 @@ func (f *feature) Enabled() bool {
4849 if f == nil {
4950 return false
5051 }
51- if on , err := strconv .ParseBool (os .Getenv (envir . DevboxFeaturePrefix + f .name )); err == nil {
52+ if on , err := strconv .ParseBool (os .Getenv (envNamePrefix + f .name )); err == nil {
5253 status := "enabled"
5354 if ! on {
5455 status = "disabled"
@@ -70,7 +71,7 @@ func (f *feature) EnableOnDev() *feature {
7071}
7172
7273func (f * feature ) EnableForTest (t * testing.T ) {
73- t .Setenv (envir . DevboxFeaturePrefix + f .name , "1" )
74+ t .Setenv (envNamePrefix + f .name , "1" )
7475}
7576
7677// All returns a map of all known features flags and whether they're enabled.
Original file line number Diff line number Diff line change @@ -5,8 +5,6 @@ package featureflag
55
66import (
77 "testing"
8-
9- "go.jetpack.io/devbox/internal/envir"
108)
119
1210func TestEnabledFeature (t * testing.T ) {
@@ -28,7 +26,7 @@ func TestDisabledFeature(t *testing.T) {
2826func TestEnabledFeatureEnv (t * testing.T ) {
2927 name := "TestEnabledFeatureEnv"
3028 disable (name )
31- t .Setenv (envir . DevboxFeaturePrefix + name , "1" )
29+ t .Setenv (envNamePrefix + name , "1" )
3230 if ! features [name ].Enabled () {
3331 t .Errorf ("got %s.Enabled() = false, want true." , name )
3432 }
Original file line number Diff line number Diff line change 44package envir
55
66const (
7- DevboxCache = "DEVBOX_CACHE"
8- DevboxFeaturePrefix = "DEVBOX_FEATURE_"
9- DevboxGateway = "DEVBOX_GATEWAY"
7+ DevboxCache = "DEVBOX_CACHE"
8+ DevboxGateway = "DEVBOX_GATEWAY"
109 // DevboxLatestVersion is the latest version available of the devbox CLI binary.
1110 // NOTE: it should NOT start with v (like 0.4.8)
1211 DevboxLatestVersion = "DEVBOX_LATEST_VERSION"
You can’t perform that action at this time.
0 commit comments