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 (
10
10
"testing"
11
11
12
12
"go.jetpack.io/devbox/internal/build"
13
- "go.jetpack.io/devbox/internal/envir"
14
13
)
15
14
15
+ const envNamePrefix = "DEVBOX_FEATURE_"
16
+
16
17
type feature struct {
17
18
name string
18
19
enabled bool
@@ -48,7 +49,7 @@ func (f *feature) Enabled() bool {
48
49
if f == nil {
49
50
return false
50
51
}
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 {
52
53
status := "enabled"
53
54
if ! on {
54
55
status = "disabled"
@@ -70,7 +71,7 @@ func (f *feature) EnableOnDev() *feature {
70
71
}
71
72
72
73
func (f * feature ) EnableForTest (t * testing.T ) {
73
- t .Setenv (envir . DevboxFeaturePrefix + f .name , "1" )
74
+ t .Setenv (envNamePrefix + f .name , "1" )
74
75
}
75
76
76
77
// 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
5
5
6
6
import (
7
7
"testing"
8
-
9
- "go.jetpack.io/devbox/internal/envir"
10
8
)
11
9
12
10
func TestEnabledFeature (t * testing.T ) {
@@ -28,7 +26,7 @@ func TestDisabledFeature(t *testing.T) {
28
26
func TestEnabledFeatureEnv (t * testing.T ) {
29
27
name := "TestEnabledFeatureEnv"
30
28
disable (name )
31
- t .Setenv (envir . DevboxFeaturePrefix + name , "1" )
29
+ t .Setenv (envNamePrefix + name , "1" )
32
30
if ! features [name ].Enabled () {
33
31
t .Errorf ("got %s.Enabled() = false, want true." , name )
34
32
}
Original file line number Diff line number Diff line change 4
4
package envir
5
5
6
6
const (
7
- DevboxCache = "DEVBOX_CACHE"
8
- DevboxFeaturePrefix = "DEVBOX_FEATURE_"
9
- DevboxGateway = "DEVBOX_GATEWAY"
7
+ DevboxCache = "DEVBOX_CACHE"
8
+ DevboxGateway = "DEVBOX_GATEWAY"
10
9
// DevboxLatestVersion is the latest version available of the devbox CLI binary.
11
10
// NOTE: it should NOT start with v (like 0.4.8)
12
11
DevboxLatestVersion = "DEVBOX_LATEST_VERSION"
You can’t perform that action at this time.
0 commit comments