aboutsummaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--registry/registry.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/registry/registry.go b/registry/registry.go
index 3f88966..442e591 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -20,9 +20,7 @@ func NewRegistry(cfg config.Config) *Registry {
reg := Registry{cfg: cfg}
reg.handlerMap = make(map[string]Handler)
for _, v := range cfg.Handlers {
- // TODO clean up
- fqn := fmt.Sprintf("acct:%s@%s", v.Name, cfg.Domain)
- reg.handlerMap[fqn] = Handler{handlerCfg: v}
+ reg.handlerMap[fqn(v.Name, cfg.Domain)] = Handler{handlerCfg: v}
}
return &reg
}
@@ -46,6 +44,10 @@ func (r *Registry) WebfingerResource(fqn string) (*resources.WebfingerResource,
return resources.RenderWebfingerResource(handler.handlerCfg.Name, r.cfg.Domain)
}
+func fqn(name, domain string) string {
+ return fmt.Sprintf("acct:%s@%s", name, domain)
+}
+
func (r *Registry) findByFQN(fqn string) *Handler {
handler, ok := r.handlerMap[fqn]
if !ok {
@@ -55,6 +57,5 @@ func (r *Registry) findByFQN(fqn string) *Handler {
}
func (r *Registry) findByName(name string) *Handler {
- fqn := fmt.Sprintf("acct:%s@%s", name, r.cfg.Domain)
- return r.findByFQN(fqn)
+ return r.findByFQN(fqn(name, r.cfg.Domain))
}