Skip to content
Draft
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: 5 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,19 @@ func inheritFlagsFromEnvironment(flags *flag.FlagSet, commandPrefix string) {
// do not prepend the env prefix if the flag name already starts with it
// (applies to one flag - "devpod-home").
var environmentVariable string
if strings.HasPrefix(suffix, config.EnvPrefix) {
isCanonical := strings.HasPrefix(suffix, config.EnvPrefix)
if isCanonical {
environmentVariable = suffix
} else {
environmentVariable = config.EnvPrefix + commandPrefix + suffix
}

// Fall back to the legacy unprefixed variable (e.g. DEVPOD_IDE)
// if the subcommand-scoped one (e.g. DEVPOD_UP_IDE) is not set.
// Skip fallback for canonical vars (e.g. devpod-home) where the
// primary lookup already uses the correct env var name.
value, exists := os.LookupEnv(environmentVariable)
if !exists && commandPrefix != "" {
if !exists && commandPrefix != "" && !isCanonical {
legacyVar := config.EnvPrefix + suffix
value, exists = os.LookupEnv(legacyVar)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/driver/custom/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func ToEnvironWithBinaries(
workspace.Machine,
workspace.Options,
nil,
"",
workspace.Workspace.Provider.Name,
)
for k, v := range agentBinaries {
environ = append(environ, k+"="+v)
Expand Down
Loading