diff --git a/internal/db/mongo.go b/internal/db/mongo.go index 0a32d1d7..98c8be82 100644 --- a/internal/db/mongo.go +++ b/internal/db/mongo.go @@ -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 } diff --git a/internal/env/env.go b/internal/env/env.go index f61f0579..16db8d5d 100644 --- a/internal/env/env.go +++ b/internal/env/env.go @@ -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 { diff --git a/internal/env/env_test.go b/internal/env/env_test.go index 905d363b..c569de9b 100644 --- a/internal/env/env_test.go +++ b/internal/env/env_test.go @@ -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") } @@ -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) } -} \ No newline at end of file +}