From 8daf1c5f1f3d0833ea4b6a951f8c3c11ebce2b0f Mon Sep 17 00:00:00 2001 From: garrettladley Date: Fri, 9 Feb 2024 19:53:24 -0500 Subject: [PATCH] added back only migrate flag since CLI depends on it's presence --- backend/src/main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/src/main.go b/backend/src/main.go index 4274c05ec..f5b1ffcc3 100644 --- a/backend/src/main.go +++ b/backend/src/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "fmt" "path/filepath" @@ -18,7 +19,12 @@ import ( // @host 127.0.0.1:8080 // @BasePath /api/v1 func main() { - config, err := config.GetConfiguration(filepath.Join("..", "..", "config")) + onlyMigrate := flag.Bool("only-migrate", false, "Specify if you want to only perform the database migration") + configPath := flag.String("config", filepath.Join("..", "..", "config"), "Specify the path to the config directory") + + flag.Parse() + + config, err := config.GetConfiguration(*configPath) if err != nil { panic(fmt.Sprintf("Error getting configuration: %s", err.Error())) } @@ -28,6 +34,10 @@ func main() { panic(fmt.Sprintf("Error configuring database: %s", err.Error())) } + if *onlyMigrate { + return + } + err = database.ConnPooling(db) if err != nil { panic(fmt.Sprintf("Error connecting to database: %s", err.Error()))