Skip to content

Commit

Permalink
fix: remove unnecessary env (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
CristhianF7 authored Oct 20, 2023
1 parent 4d24877 commit ff127b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions internal/db/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (mdbcl *MongoDBClient) TestDatabaseConnection(silent bool) error {
}

// ImportClusterIfEmpty
func (mdbcl *MongoDBClient) ImportClusterIfEmpty(silent bool, cloudProvider string) (pkgtypes.Cluster, error) {
func (mdbcl *MongoDBClient) ImportClusterIfEmpty(silent bool) (pkgtypes.Cluster, error) {
log.SetFormatter(&log.TextFormatter{
FullTimestamp: true,
TimestampFormat: "",
Expand All @@ -102,10 +102,6 @@ func (mdbcl *MongoDBClient) ImportClusterIfEmpty(silent bool, cloudProvider stri
log.Info("IS_CLUSTER_ZERO is set to true, skipping import cluster logic.")
return pkgtypes.Cluster{}, nil
}
if os.Getenv("CLOUD_PROVIDER") == "k3d" {
log.Info("CLOUD_PROVIDER is set to k3d, skipping import cluster logic.")
return pkgtypes.Cluster{}, nil
}

homeDir, err := os.UserHomeDir()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func main() {
if os.Getenv("MONGODB_HOST_TYPE") == "" {
log.Fatalf("the MONGODB_HOST_TYPE environment variable must be set to either: atlas, local")
}
for _, v := range []string{"MONGODB_HOST", "MONGODB_USERNAME", "MONGODB_PASSWORD", "CLOUD_PROVIDER"} {
for _, v := range []string{"MONGODB_HOST", "MONGODB_USERNAME", "MONGODB_PASSWORD"} {
if os.Getenv(v) == "" {
log.Fatalf("the %s environment variable must be set", v)
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func main() {

log.Infof("checking for cluster import secret for management cluster")
// Import if needed
importedCluster, err := db.Client.ImportClusterIfEmpty(false, os.Getenv("CLOUD_PROVIDER"))
importedCluster, err := db.Client.ImportClusterIfEmpty(false)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit ff127b6

Please sign in to comment.