Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions internal/boxcli/featureflag/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
"testing"

"go.jetpack.io/devbox/internal/build"
"go.jetpack.io/devbox/internal/envir"
)

const envNamePrefix = "DEVBOX_FEATURE_"

type feature struct {
name string
enabled bool
Expand Down Expand Up @@ -48,7 +49,7 @@ func (f *feature) Enabled() bool {
if f == nil {
return false
}
if on, err := strconv.ParseBool(os.Getenv(envir.DevboxFeaturePrefix + f.name)); err == nil {
if on, err := strconv.ParseBool(os.Getenv(envNamePrefix + f.name)); err == nil {
status := "enabled"
if !on {
status = "disabled"
Expand All @@ -70,7 +71,7 @@ func (f *feature) EnableOnDev() *feature {
}

func (f *feature) EnableForTest(t *testing.T) {
t.Setenv(envir.DevboxFeaturePrefix+f.name, "1")
t.Setenv(envNamePrefix+f.name, "1")
}

// All returns a map of all known features flags and whether they're enabled.
Expand Down
4 changes: 1 addition & 3 deletions internal/boxcli/featureflag/feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ package featureflag

import (
"testing"

"go.jetpack.io/devbox/internal/envir"
)

func TestEnabledFeature(t *testing.T) {
Expand All @@ -28,7 +26,7 @@ func TestDisabledFeature(t *testing.T) {
func TestEnabledFeatureEnv(t *testing.T) {
name := "TestEnabledFeatureEnv"
disable(name)
t.Setenv(envir.DevboxFeaturePrefix+name, "1")
t.Setenv(envNamePrefix+name, "1")
if !features[name].Enabled() {
t.Errorf("got %s.Enabled() = false, want true.", name)
}
Expand Down
5 changes: 2 additions & 3 deletions internal/envir/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
package envir

const (
DevboxCache = "DEVBOX_CACHE"
DevboxFeaturePrefix = "DEVBOX_FEATURE_"
DevboxGateway = "DEVBOX_GATEWAY"
DevboxCache = "DEVBOX_CACHE"
DevboxGateway = "DEVBOX_GATEWAY"
// DevboxLatestVersion is the latest version available of the devbox CLI binary.
// NOTE: it should NOT start with v (like 0.4.8)
DevboxLatestVersion = "DEVBOX_LATEST_VERSION"
Expand Down
Loading