diff options
Diffstat (limited to 'registry/registry.go')
-rw-r--r-- | registry/registry.go | 8 |
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) { |