Skip to content

Commit

Permalink
added back only migrate flag since CLI depends on it's presence
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley committed Feb 10, 2024
1 parent 5adba7e commit 8daf1c5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backend/src/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"flag"
"fmt"
"path/filepath"

Expand All @@ -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()))
}
Expand All @@ -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()))
Expand Down

0 comments on commit 8daf1c5

Please sign in to comment.