Skip to content

Commit

Permalink
change bool to string (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarededwards authored Nov 19, 2023
1 parent c79a4fe commit d5c26bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/db/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (mdbcl *MongoDBClient) ImportClusterIfEmpty(silent bool) (pkgtypes.Cluster,
// find the secret in mgmt cluster's kubefirst namespace and read import payload and clustername
var kcfg *k8s.KubernetesClient

if env.IsClusterZero {
if env.IsClusterZero == "" {
log.Info("IS_CLUSTER_ZERO is set to true, skipping import cluster logic.")
return pkgtypes.Cluster{}, nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ type Env struct {
KubefirstTeamInfo string `env:"KUBEFIRST_TEAM_INFO"`
AWSRegion string `env:"AWS_REGION"`
AWSProfile string `env:"AWS_PROFILE"`
IsClusterZero bool `env:"IS_CLUSTER_ZERO"`
IsClusterZero string `env:"IS_CLUSTER_ZERO"`
InCluster bool `env:"IN_CLUSTER" envDefault:"false"`
EnterpriseApiUrl string `env:"ENTERPRISE_API_URL"`
}

func GetEnv(silent bool)(Env,error) {
func GetEnv(silent bool) (Env, error) {
err := godotenv.Load(".env")

if err != nil && !silent {
Expand Down
4 changes: 2 additions & 2 deletions internal/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestEnv(t *testing.T) {
t.Errorf("expected AWSProfile to be 'aws_profile', but got '%s'", env.AWSProfile)
}

if env.IsClusterZero != true {
if env.IsClusterZero != "true" {
t.Errorf("expected IsClusterZero to be true, but got false")
}

Expand All @@ -135,4 +135,4 @@ func TestEnv(t *testing.T) {
if env.EnterpriseApiUrl != "enterprise_api_url" {
t.Errorf("expected EnterpriseApiUrl to be 'enterprise_api_url', but got '%s'", env.EnterpriseApiUrl)
}
}
}

0 comments on commit d5c26bc

Please sign in to comment.