diff options
author | Julio Capote <jcapote@gmail.com> | 2022-12-19 00:32:42 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-12-19 00:32:42 +0000 |
commit | bd06b6e688c63ea9eb05e187e18ce535286ca3d4 (patch) | |
tree | 92954f44051865193a009af09e6f10a5fd83e697 | |
parent | 2ee94a66d89de9eb0461f250251af7776aef9976 (diff) | |
download | communique-bd06b6e688c63ea9eb05e187e18ce535286ca3d4.tar.gz |
cleanup
Diffstat (limited to '')
-rw-r--r-- | registry/registry.go | 11 |
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 ® } @@ -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)) } |