summaryrefslogtreecommitdiff
path: root/cmd/start.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/start.go')
-rw-r--r--cmd/start.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/start.go b/cmd/start.go
index 00872aa..a1f051c 100644
--- a/cmd/start.go
+++ b/cmd/start.go
@@ -1,9 +1,10 @@
package cmd
import (
- "os"
"apjournal/config"
+ database "apjournal/internal/database/sql"
"apjournal/internal/server"
+ "os"
"log/slog"
@@ -28,8 +29,11 @@ var startCmd = &cobra.Command{
"path", viper.ConfigFileUsed())
}
cfg := config.LoadConfig(viper.GetViper())
-
- srv := server.NewServer(cfg, log)
+ db, err := database.InitWithMigrate(cfg.DBURI, true)
+ if err != nil {
+ panic(err)
+ }
+ srv := server.NewServer(cfg, log, db.Conn)
// listen for new messages
log.Info("Listening for incoming events")
srv.Listen()