diff options
Diffstat (limited to '')
-rw-r--r-- | main.go | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -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) |