From 3761f85966a554cb750809da21995354fb9f9ceb Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Sun, 18 Dec 2022 22:00:36 -0500 Subject: uncommit --- main.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'main.go') 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) -- cgit v1.2.3