Skip to content

Commit

Permalink
Remove dependency on pulumi sdk/go/common/env (#421)
Browse files Browse the repository at this point in the history
This is the only use of `sdk/go/common/env` outside of `pulumi/pulumi`,
and it's easily removed by inlining the name of the relevant environment
variable. Since we already do this in a few other places (e.g. backend
URL lookup), this commit makes the change and breaks the dependency.
  • Loading branch information
lunaris authored Dec 5, 2024
1 parent 52ec84f commit 0a8fc41
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/esc/cli/env_rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ import (
"context"
"errors"
"fmt"
"os"

"github.com/spf13/cobra"
"gopkg.in/yaml.v3"

"github.com/pulumi/esc/syntax/encoding"
"github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors"
pulumienv "github.com/pulumi/pulumi/sdk/v3/go/common/env"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
)

// PulumiSkipConfirmationsEnvVar is an environment variable that can be used to skip confirmation prompts. This matches
// the variable used by the core Pulumi CLI.
const PulumiSkipConfirmationsEnvVar = "PULUMI_SKIP_CONFIRMATIONS"

func newEnvRmCmd(env *envCommand) *cobra.Command {
var yes bool

Expand All @@ -33,7 +38,7 @@ func newEnvRmCmd(env *envCommand) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

yes = yes || pulumienv.SkipConfirmations.Value()
yes = yes || cmdutil.IsTruthy(os.Getenv(PulumiSkipConfirmationsEnvVar))

if err := env.esc.getCachedClient(ctx); err != nil {
return err
Expand Down

0 comments on commit 0a8fc41

Please sign in to comment.