Ver código fonte

Do not show $DATABASE_URL warning when showing application info

Frédéric Guillot 7 anos atrás
pai
commit
35b890aadc
1 arquivos alterados com 8 adições e 8 exclusões
  1. 8 8
      cli/cli.go

+ 8 - 8
cli/cli.go

@@ -57,14 +57,6 @@ func Parse() {
 		logger.EnableDebug()
 		logger.EnableDebug()
 	}
 	}
 
 
-	db, err := database.NewConnectionPool(cfg.DatabaseURL(), cfg.DatabaseMinConns(), cfg.DatabaseMaxConns())
-	if err != nil {
-		logger.Fatal("Unable to connect to the database: %v", err)
-	}
-	defer db.Close()
-
-	store := storage.NewStorage(db)
-
 	if flagInfo {
 	if flagInfo {
 		info()
 		info()
 		return
 		return
@@ -75,11 +67,19 @@ func Parse() {
 		return
 		return
 	}
 	}
 
 
+	db, err := database.NewConnectionPool(cfg.DatabaseURL(), cfg.DatabaseMinConns(), cfg.DatabaseMaxConns())
+	if err != nil {
+		logger.Fatal("Unable to connect to the database: %v", err)
+	}
+	defer db.Close()
+
 	if flagMigrate {
 	if flagMigrate {
 		database.Migrate(db)
 		database.Migrate(db)
 		return
 		return
 	}
 	}
 
 
+	store := storage.NewStorage(db)
+
 	if flagResetFeedErrors {
 	if flagResetFeedErrors {
 		store.ResetFeedErrors()
 		store.ResetFeedErrors()
 		return
 		return