Skip to content

Commit

Permalink
Warn users when the target environment for the CLI is staging (#2071)
Browse files Browse the repository at this point in the history
Staging can sometimes be unstable and there's need to warn users about
this
  • Loading branch information
AGMETEOR authored Jan 4, 2024
1 parent e599927 commit 45f27e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/cli/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/spf13/viper"

clientconfig "github.com/stacklok/minder/internal/config/client"
"github.com/stacklok/minder/internal/constants"
ghclient "github.com/stacklok/minder/internal/providers/github"
"github.com/stacklok/minder/internal/util/cli"
)
Expand All @@ -37,6 +38,12 @@ var (
Long: `For more information about minder, please visit:
https://docs.stacklok.com/minder`,
SilenceErrors: true, // don't print errors twice, we handle them in cli.ExitNicelyOnError
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if constants.TargetEnv == "staging" {
cmd.Print("WARNING: This build uses a test environment and may not be stable \n")
}
return nil
},
}
)

Expand Down
2 changes: 2 additions & 0 deletions internal/constants/prod.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package constants

const (
// TargetEnv is the environment the build will point to
TargetEnv = "prod"
// IdentitySeverURL is the URL of the identity server
IdentitySeverURL = "https://auth.stacklok.com"
// MinderGRPCHost is the host of the minder gRPC server
Expand Down
2 changes: 2 additions & 0 deletions internal/constants/staging.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package constants

const (
// TargetEnv is the environment the build will point to
TargetEnv = "staging"
// IdentitySeverURL is the URL of the identity server
IdentitySeverURL = "https://auth.staging.stacklok.dev"
// MinderGRPCHost is the host of the minder gRPC server
Expand Down

0 comments on commit 45f27e5

Please # to comment.