aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-19 03:00:36 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-19 03:00:36 +0000
commit3761f85966a554cb750809da21995354fb9f9ceb (patch)
tree95731280e9afe5b1879e67e3989efd12d1f1613b /main.go
parent326eef243c22a739588cfb74642eb9267d020dee (diff)
downloadcommunique-3761f85966a554cb750809da21995354fb9f9ceb.tar.gz
uncommit
Diffstat (limited to '')
-rw-r--r--main.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/main.go b/main.go
index 165cacb..fe2bb30 100644
--- a/main.go
+++ b/main.go
@@ -8,6 +8,7 @@ import (
"git.capotej.com/capotej/communique/http"
"git.capotej.com/capotej/communique/registry"
"github.com/BurntSushi/toml"
+ "github.com/dgraph-io/badger/v3"
"go.uber.org/zap"
"go.uber.org/zap/zapio"
)
@@ -27,16 +28,26 @@ func main() {
log.Fatal(err)
}
log.Debugf("Loaded TOML Config: %+v", cfg)
- registry := registry.NewRegistry(cfg)
+ // DB
+ db, err := badger.Open(badger.DefaultOptions(cfg.DbPath))
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer db.Close()
+
+ // Registry
+ registry := registry.NewRegistry(cfg, db)
+
+ // Servers
var mainWg sync.WaitGroup
- // Internal CGI Servers
- cgiServers := cgi.NewServers()
+ // // Internal CGI Servers
+ cgiServers := cgi.NewServers(log, db)
mainWg.Add(1)
go cgiServers.Start(cfg)
- // External Http Server
+ // // External Http Server
writer := &zapio.Writer{Log: logger, Level: zap.DebugLevel}
defer writer.Close()
server := http.NewServer(registry)