aboutsummaryrefslogtreecommitdiff
path: root/registry
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 /registry
parent326eef243c22a739588cfb74642eb9267d020dee (diff)
downloadcommunique-3761f85966a554cb750809da21995354fb9f9ceb.tar.gz
uncommit
Diffstat (limited to '')
-rw-r--r--registry/registry.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/registry/registry.go b/registry/registry.go
index b12b773..8d047ff 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -5,6 +5,7 @@ import (
"git.capotej.com/capotej/communique/config"
"git.capotej.com/capotej/communique/resources"
+ "github.com/dgraph-io/badger/v3"
)
type Handler struct {
@@ -13,11 +14,12 @@ type Handler struct {
type Registry struct {
cfg config.Config
+ db *badger.DB
handlerMap map[string]Handler
}
-func NewRegistry(cfg config.Config) *Registry {
- reg := Registry{cfg: cfg}
+func NewRegistry(cfg config.Config, db *badger.DB) *Registry {
+ reg := Registry{cfg: cfg, db: db}
reg.handlerMap = make(map[string]Handler)
for _, v := range cfg.Handlers {
reg.handlerMap[fqn(v.Name, cfg.Domain)] = Handler{handlerCfg: v}
@@ -38,7 +40,7 @@ func (r *Registry) Outbox(name string) (map[string]interface{}, error) {
if handler == nil {
return nil, nil
}
- return resources.RenderOutbox(handler.handlerCfg.Name, r.cfg.Domain)
+ return resources.RenderOutbox(handler.handlerCfg.Name, r.cfg.Domain, r.db)
}
func (r *Registry) WebfingerResource(fqn string) (*resources.WebfingerResource, error) {