diff --git a/api/account.go b/api/account.go new file mode 100644 index 0000000..a449a72 --- /dev/null +++ b/api/account.go @@ -0,0 +1,13 @@ +package api + +import ( + "git.lumeweb.com/LumeWeb/portal/api/account" + "git.lumeweb.com/LumeWeb/portal/api/registry" +) + +func init() { + registry.Register(registry.APIEntry{ + Key: "account", + Module: account.Module, + }) +} diff --git a/api/api.go b/api/api.go index 00e01a9..b2ac798 100644 --- a/api/api.go +++ b/api/api.go @@ -6,24 +6,11 @@ import ( "git.lumeweb.com/LumeWeb/portal/api/middleware" - "git.lumeweb.com/LumeWeb/portal/api/account" "git.lumeweb.com/LumeWeb/portal/api/registry" - "git.lumeweb.com/LumeWeb/portal/api/s5" "github.com/spf13/viper" "go.uber.org/fx" ) -func RegisterApis() { - registry.Register(registry.APIEntry{ - Key: "s5", - Module: s5.Module, - }) - registry.Register(registry.APIEntry{ - Key: "account", - Module: account.Module, - }) -} - func BuildApis(config *viper.Viper) fx.Option { var options []fx.Option enabledProtocols := config.GetStringSlice("core.protocols") diff --git a/api/s5.go b/api/s5.go new file mode 100644 index 0000000..0387e92 --- /dev/null +++ b/api/s5.go @@ -0,0 +1,15 @@ +//go:build s5 + +package api + +import ( + "git.lumeweb.com/LumeWeb/portal/api/registry" + "git.lumeweb.com/LumeWeb/portal/api/s5" +) + +func init() { + registry.Register(registry.APIEntry{ + Key: "s5", + Module: s5.Module, + }) +} diff --git a/cmd/portal/main.go b/cmd/portal/main.go index 4931ff4..257079c 100644 --- a/cmd/portal/main.go +++ b/cmd/portal/main.go @@ -34,9 +34,6 @@ func main() { flag.BoolVar(&fxDebug, "fx-debug", false, "Enable fx framework debug logging") flag.Parse() - protocols.RegisterProtocols() - api.RegisterApis() - var fxLogger fx.Option fxLogger = fx.WithLogger(func(logger *zap.Logger) fxevent.Logger { diff --git a/protocols/protocols.go b/protocols/protocols.go index 1ab1099..ef20dc1 100644 --- a/protocols/protocols.go +++ b/protocols/protocols.go @@ -4,20 +4,11 @@ import ( "context" "git.lumeweb.com/LumeWeb/portal/protocols/registry" - "git.lumeweb.com/LumeWeb/portal/protocols/s5" "github.com/samber/lo" "github.com/spf13/viper" "go.uber.org/fx" ) -func RegisterProtocols() { - registry.Register(registry.ProtocolEntry{ - Key: "s5", - Module: s5.ProtocolModule, - PreInitFunc: s5.PreInit, - }) -} - func BuildProtocols(config *viper.Viper) fx.Option { var options []fx.Option enabledProtocols := config.GetStringSlice("core.protocols") diff --git a/protocols/s5.go b/protocols/s5.go new file mode 100644 index 0000000..4e8dddb --- /dev/null +++ b/protocols/s5.go @@ -0,0 +1,16 @@ +//go:build s5 + +package protocols + +import ( + "git.lumeweb.com/LumeWeb/portal/protocols/registry" + "git.lumeweb.com/LumeWeb/portal/protocols/s5" +) + +func init() { + registry.Register(registry.ProtocolEntry{ + Key: "s5", + Module: s5.ProtocolModule, + PreInitFunc: s5.PreInit, + }) +}