diff options
author | Julio Capote <jcapote@gmail.com> | 2022-12-19 03:00:36 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-12-19 03:00:36 +0000 |
commit | 3761f85966a554cb750809da21995354fb9f9ceb (patch) | |
tree | 95731280e9afe5b1879e67e3989efd12d1f1613b /main.go | |
parent | 326eef243c22a739588cfb74642eb9267d020dee (diff) | |
download | communique-3761f85966a554cb750809da21995354fb9f9ceb.tar.gz |
uncommit
Diffstat (limited to 'main.go')
-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) |