Skip to content

Commit

Permalink
Apply filter to the ENVs passed to the command (#458)
Browse files Browse the repository at this point in the history
Filter AWS_PROFILE from the ENVS that are passed to the sub command of `sst shell` this avoids a connection error in the was sdk.
  • Loading branch information
alistairstead committed May 25, 2024
1 parent ad8656c commit a726389
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/sst/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,18 @@ var Root = Command{
args[0],
args[1:]...,
)
// Get the environment variables
envs := os.Environ()

// Filter the environment variables to exclude AWS_PROFILE
filteredEnvs := make([]string, 0, len(envs))
for _, val := range envs {
if !strings.HasPrefix(val, "AWS_PROFILE=") {
filteredEnvs = append(filteredEnvs, val)
}
}
cmd.Env = append(cmd.Env,
os.Environ()...,
filteredEnvs...,
)
cmd.Env = append(cmd.Env,
fmt.Sprintf("PS1=%s/%s> ", p.App().Name, p.App().Stage),
Expand Down

0 comments on commit a726389

Please sign in to comment.