aboutsummaryrefslogtreecommitdiffhomepage
path: root/cli/cli.go
diff options
context:
space:
mode:
Diffstat (limited to 'cli/cli.go')
-rw-r--r--cli/cli.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cli/cli.go b/cli/cli.go
index 629367a..623b9bb 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -57,14 +57,6 @@ func Parse() {
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 {
info()
return
@@ -75,11 +67,19 @@ func Parse() {
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 {
database.Migrate(db)
return
}
+ store := storage.NewStorage(db)
+
if flagResetFeedErrors {
store.ResetFeedErrors()
return