aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.go b/main.go
index b5720b1..d7ab887 100644
--- a/main.go
+++ b/main.go
@@ -9,6 +9,7 @@ import (
"git.capotej.com/capotej/communique/controller"
"git.capotej.com/capotej/communique/http"
"git.capotej.com/capotej/communique/models"
+
"github.com/BurntSushi/toml"
"github.com/dgraph-io/badger/v3"
"github.com/microcosm-cc/bluemonday"
@@ -31,7 +32,12 @@ func main() {
if err != nil {
log.Fatal(err)
}
- log.Debugf("Loaded TOML Config: %+v", cfg)
+ log.Debugf("Loaded config: %+v", cfg)
+ err = cfg.Validate()
+ if err != nil {
+ log.Fatal(err)
+ }
+ log.Debugf("Validated Config: %+v", cfg)
// DB
dbOpts := badger.DefaultOptions(cfg.DbPath)
@@ -59,7 +65,7 @@ func main() {
persister := models.NewPersister(log, db)
// Controller
- controller, err := controller.NewController(cfg, persister, log)
+ registry, err := controller.NewController(cfg, persister, log)
if err != nil {
log.Fatal(err)
}
@@ -76,7 +82,7 @@ func main() {
// // External Http Server
writer := &zapio.Writer{Log: logger, Level: zap.DebugLevel}
defer writer.Close()
- router := http.NewRouter(controller, log)
+ router := http.NewRouter(registry, log)
mainWg.Add(1)
go router.Start(writer)