Skip to content

Commit e4be812

Browse files
authored
chore: update env constants and functions (#954)
## Summary 1. Unexport some constants in `env` 2. Rename some functions in `env` ## How was it tested?
1 parent 29f98d1 commit e4be812

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed

internal/cloud/openssh/sshshim/invoke.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"syscall"
1111

1212
"github.com/pkg/errors"
13+
1314
"go.jetpack.io/devbox/internal/debug"
1415
)
1516

internal/env/env.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package env
55

66
const (
77
DevboxCache = "DEVBOX_CACHE"
8-
DevboxCLICloudShell = "DEVBOX_CLI_CLOUD_SHELL"
8+
devboxCLICloudShell = "DEVBOX_CLI_CLOUD_SHELL"
99
DevboxDebug = "DEVBOX_DEBUG"
1010
DevboxFeaturePrefix = "DEVBOX_FEATURE_"
1111
DevboxGateway = "DEVBOX_GATEWAY"
@@ -16,14 +16,10 @@ const (
1616
DevboxShellStartTime = "DEVBOX_SHELL_START_TIME"
1717
DevboxVM = "DEVBOX_VM"
1818

19-
DoNotTrack = "DO_NOT_TRACK"
20-
2119
LauncherVersion = "LAUNCHER_VERSION"
2220

2321
SSHTTY = "SSH_TTY"
2422

25-
StartWebTerminal = "START_WEB_TERMINAL"
26-
2723
XDGDataHome = "XDG_DATA_HOME"
2824
XDGConfigHome = "XDG_CONFIG_HOME"
2925
XDGCacheHome = "XDG_CACHE_HOME"

internal/env/util.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
func IsCLICloudShell() bool {
12-
cliCloudShell, _ := strconv.ParseBool(os.Getenv(DevboxCLICloudShell))
12+
cliCloudShell, _ := strconv.ParseBool(os.Getenv(devboxCLICloudShell))
1313
return cliCloudShell
1414
}
1515

@@ -22,9 +22,9 @@ func IsDevboxShellEnabled() bool {
2222
return inDevboxShell
2323
}
2424

25-
func NotTrack() bool {
25+
func DoNotTrack() bool {
2626
// https://consoledonottrack.com/
27-
doNotTrack, _ := strconv.ParseBool(os.Getenv(DoNotTrack))
27+
doNotTrack, _ := strconv.ParseBool(os.Getenv("DO_NOT_TRACK"))
2828
return doNotTrack
2929
}
3030

@@ -33,13 +33,13 @@ func IsDevboxDebugEnabled() bool {
3333
return enabled
3434
}
3535

36-
func NotUpgradeConfig() bool {
36+
func DoNotUpgradeConfig() bool {
3737
notUpgrade, _ := strconv.ParseBool(os.Getenv(DevboxDoNotUpgradeConfig))
3838
return notUpgrade
3939
}
4040

4141
func IsInBrowser() bool { // TODO: a better name
42-
inBrowser, _ := strconv.ParseBool(os.Getenv(StartWebTerminal))
42+
inBrowser, _ := strconv.ParseBool(os.Getenv("START_WEB_TERMINAL"))
4343
return inBrowser
4444
}
4545

internal/impl/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func readConfigFromURL(url *url.URL) (*Config, error) {
8888
}
8989

9090
func upgradeConfig(cfg *Config, absFilePath string) error {
91-
if env.NotUpgradeConfig() {
91+
if env.DoNotUpgradeConfig() {
9292
return nil
9393
}
9494
if cfg.Nixpkgs.Commit == "" {

internal/impl/shellcmd/command.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
// Formats for marshalling and unmarshalling a series of shell commands in a
1616
// devbox config.
1717
const (
18-
// CmdArray formats shell commands as an array of of strings.
18+
// CmdArray formats shell commands as an array of strings.
1919
CmdArray CmdFormat = iota
2020

2121
// CmdString formats shell commands as a single string.
@@ -46,7 +46,6 @@ type Commands struct {
4646
// UnmarshalJSON will set MarshalAs automatically so that commands
4747
// marshal back to their original format. The default zero-value
4848
// formats them as an array.
49-
//
5049
MarshalAs CmdFormat
5150
Cmds []string
5251
}

internal/telemetry/sentry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var started bool
5050

5151
// Start enables telemetry for the current program.
5252
func Start(appName string) {
53-
if started || env.NotTrack() {
53+
if started || env.DoNotTrack() {
5454
return
5555
}
5656
started = initSentry(appName)

internal/telemetry/telemetry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
func init() {
2121
// TODO(gcurtis): clean this up so that Sentry and Segment use the same
2222
// start/stop functions.
23-
if env.NotTrack() || build.TelemetryKey == "" {
23+
if env.DoNotTrack() || build.TelemetryKey == "" {
2424
return
2525
}
2626
enabled = true

0 commit comments

Comments
 (0)