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