From a85ced7c62f2039681ad59ba603993f9c4f7b2e6 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 17 Mar 2024 08:36:32 -0400 Subject: [PATCH] refactor: change Registry name to EntryRegistry --- api/account.go | 2 +- api/api.go | 4 ++-- api/registry/registry.go | 10 +++++----- api/s5.go | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/account.go b/api/account.go index a449a72..a33707f 100644 --- a/api/account.go +++ b/api/account.go @@ -6,7 +6,7 @@ import ( ) func init() { - registry.Register(registry.APIEntry{ + registry.RegisterEntry(registry.APIEntry{ Key: "account", Module: account.Module, }) diff --git a/api/api.go b/api/api.go index 23d382d..c7fb674 100644 --- a/api/api.go +++ b/api/api.go @@ -15,7 +15,7 @@ var alwaysEnabled = []string{"account"} func BuildApis(cm *config.Manager) fx.Option { var options []fx.Option enabledProtocols := cm.Viper().GetStringSlice("core.protocols") - for _, entry := range registry.GetRegistry() { + for _, entry := range registry.GetEntryRegistry() { if slices.Contains(enabledProtocols, entry.Key) || slices.Contains(alwaysEnabled, entry.Key) { options = append(options, entry.Module) } @@ -47,7 +47,7 @@ type LifecyclesParams struct { } func SetupLifecycles(lifecycle fx.Lifecycle, params LifecyclesParams) error { - for _, entry := range registry.GetRegistry() { + for _, entry := range registry.GetEntryRegistry() { for _, protocol := range params.Protocols { if protocol.Name() == entry.Key { lifecycle.Append(fx.Hook{ diff --git a/api/registry/registry.go b/api/registry/registry.go index 2f65aae..f11ffa9 100644 --- a/api/registry/registry.go +++ b/api/registry/registry.go @@ -19,19 +19,19 @@ type APIEntry struct { Module fx.Option } -var apiRegistry []APIEntry +var apiEntryRegistry []APIEntry var router *router2.APIRouter func init() { router = router2.NewAPIRouter() } -func Register(entry APIEntry) { - apiRegistry = append(apiRegistry, entry) +func RegisterEntry(entry APIEntry) { + apiEntryRegistry = append(apiEntryRegistry, entry) } -func GetRegistry() []APIEntry { - return apiRegistry +func GetEntryRegistry() []APIEntry { + return apiEntryRegistry } func GetRouter() *router2.APIRouter { diff --git a/api/s5.go b/api/s5.go index 0387e92..681a468 100644 --- a/api/s5.go +++ b/api/s5.go @@ -8,7 +8,7 @@ import ( ) func init() { - registry.Register(registry.APIEntry{ + registry.RegisterEntry(registry.APIEntry{ Key: "s5", Module: s5.Module, })