From f4644a6225dca63f0600fa32b7ddde7ea94f214b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villaf=C3=A1=C3=B1ez?= Date: Wed, 19 Mar 2025 10:29:01 +0100 Subject: [PATCH] chore: change constant name to camelcase --- ocis-pkg/generators/natsnames.go | 6 +++--- ocis-pkg/natsjsregistry/registry.go | 2 +- services/activitylog/pkg/command/server.go | 2 +- services/antivirus/pkg/service/service.go | 2 +- services/audit/pkg/command/server.go | 2 +- services/clientlog/pkg/command/server.go | 2 +- services/eventhistory/pkg/command/server.go | 2 +- services/frontend/pkg/command/events.go | 2 +- services/graph/pkg/server/http/server.go | 2 +- services/notifications/pkg/command/send_email.go | 2 +- services/notifications/pkg/command/server.go | 2 +- services/policies/pkg/command/server.go | 2 +- services/postprocessing/pkg/command/postprocessing.go | 2 +- services/postprocessing/pkg/command/server.go | 2 +- services/proxy/pkg/command/server.go | 2 +- services/search/pkg/service/grpc/v0/service.go | 2 +- services/sharing/pkg/revaconfig/config.go | 2 +- services/sse/pkg/command/server.go | 2 +- services/storage-users/pkg/event/event.go | 2 +- services/storage-users/pkg/revaconfig/config.go | 2 +- services/userlog/pkg/command/server.go | 2 +- 21 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ocis-pkg/generators/natsnames.go b/ocis-pkg/generators/natsnames.go index 54fc15f7245..a35c9d751b5 100644 --- a/ocis-pkg/generators/natsnames.go +++ b/ocis-pkg/generators/natsnames.go @@ -9,9 +9,9 @@ import ( type NType int const ( - NTYPE_BUS NType = iota - NTYPE_KEYVALUE - NTYPE_REGISTRY + NTypeBus NType = iota + NTypeKeyValue + NTypeRegistry ) func (n NType) String() string { diff --git a/ocis-pkg/natsjsregistry/registry.go b/ocis-pkg/natsjsregistry/registry.go index e9d1c87db5d..9219d48816d 100644 --- a/ocis-pkg/natsjsregistry/registry.go +++ b/ocis-pkg/natsjsregistry/registry.go @@ -201,7 +201,7 @@ func (n *storeregistry) storeOptions(opts registry.Options) []store.Option { storeoptions = append(storeoptions, store.Nodes(addr...)) natsOptions := nats.GetDefaultOptions() - natsOptions.Name = generators.GenerateConnectionName(serviceName, generators.NTYPE_REGISTRY) + natsOptions.Name = generators.GenerateConnectionName(serviceName, generators.NTypeRegistry) natsOptions.User, natsOptions.Password = getAuth() natsOptions.ReconnectedCB = func(_ *nats.Conn) { if err := n.Init(); err != nil { diff --git a/services/activitylog/pkg/command/server.go b/services/activitylog/pkg/command/server.go index 0c59de5e547..7fad0a14c58 100644 --- a/services/activitylog/pkg/command/server.go +++ b/services/activitylog/pkg/command/server.go @@ -71,7 +71,7 @@ func Server(cfg *config.Config) *cli.Command { defer cancel() - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) evStream, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { logger.Error().Err(err).Msg("Failed to initialize event stream") diff --git a/services/antivirus/pkg/service/service.go b/services/antivirus/pkg/service/service.go index 68e246ac730..7f27ce16873 100644 --- a/services/antivirus/pkg/service/service.go +++ b/services/antivirus/pkg/service/service.go @@ -108,7 +108,7 @@ func (av Antivirus) Run() error { av.c.Events.TLSInsecure = false } - connName := generators.GenerateConnectionName(av.c.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(av.c.Service.Name, generators.NTypeBus) natsStream, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(av.c.Events)) if err != nil { return err diff --git a/services/audit/pkg/command/server.go b/services/audit/pkg/command/server.go index b58a0965fdc..474e90ff533 100644 --- a/services/audit/pkg/command/server.go +++ b/services/audit/pkg/command/server.go @@ -37,7 +37,7 @@ func Server(cfg *config.Config) *cli.Command { ) defer cancel() - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) client, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { return err diff --git a/services/clientlog/pkg/command/server.go b/services/clientlog/pkg/command/server.go index 1ba02f51bde..dad92a200c6 100644 --- a/services/clientlog/pkg/command/server.go +++ b/services/clientlog/pkg/command/server.go @@ -69,7 +69,7 @@ func Server(cfg *config.Config) *cli.Command { defer cancel() - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) s, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { return err diff --git a/services/eventhistory/pkg/command/server.go b/services/eventhistory/pkg/command/server.go index c8df047f11a..1f3114a44ed 100644 --- a/services/eventhistory/pkg/command/server.go +++ b/services/eventhistory/pkg/command/server.go @@ -56,7 +56,7 @@ func Server(cfg *config.Config) *cli.Command { m.BuildInfo.WithLabelValues(version.GetString()).Set(1) - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) consumer, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { return err diff --git a/services/frontend/pkg/command/events.go b/services/frontend/pkg/command/events.go index 87777131935..d66b6fe56d4 100644 --- a/services/frontend/pkg/command/events.go +++ b/services/frontend/pkg/command/events.go @@ -35,7 +35,7 @@ var _registeredEvents = []events.Unmarshaller{ // ListenForEvents listens for events and acts accordingly func ListenForEvents(ctx context.Context, cfg *config.Config, l log.Logger) error { - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) bus, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { l.Error().Err(err).Msg("cannot connect to nats") diff --git a/services/graph/pkg/server/http/server.go b/services/graph/pkg/server/http/server.go index 36641a76c5b..241e95cd0a5 100644 --- a/services/graph/pkg/server/http/server.go +++ b/services/graph/pkg/server/http/server.go @@ -54,7 +54,7 @@ func Server(opts ...Option) (http.Service, error) { if options.Config.Events.Endpoint != "" { var err error - connName := generators.GenerateConnectionName(options.Config.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(options.Config.Service.Name, generators.NTypeBus) eventsStream, err = stream.NatsFromConfig(connName, false, stream.NatsConfig(options.Config.Events)) if err != nil { options.Logger.Error(). diff --git a/services/notifications/pkg/command/send_email.go b/services/notifications/pkg/command/send_email.go index 7da6c590f04..d539727d03c 100644 --- a/services/notifications/pkg/command/send_email.go +++ b/services/notifications/pkg/command/send_email.go @@ -34,7 +34,7 @@ func SendEmail(cfg *config.Config) *cli.Command { if !daily && !weekly { return errors.New("at least one of '--daily' or '--weekly' must be set") } - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) s, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Notifications.Events)) if err != nil { return err diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index 902365a2d6b..051703d8614 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -96,7 +96,7 @@ func Server(cfg *config.Config) *cli.Command { registeredEvents[typ.String()] = e } - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) client, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Notifications.Events)) if err != nil { return err diff --git a/services/policies/pkg/command/server.go b/services/policies/pkg/command/server.go index 071972d212f..3589a275275 100644 --- a/services/policies/pkg/command/server.go +++ b/services/policies/pkg/command/server.go @@ -105,7 +105,7 @@ func Server(cfg *config.Config) *cli.Command { { - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) bus, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { return err diff --git a/services/postprocessing/pkg/command/postprocessing.go b/services/postprocessing/pkg/command/postprocessing.go index 3d6abe16346..94cc8d04535 100644 --- a/services/postprocessing/pkg/command/postprocessing.go +++ b/services/postprocessing/pkg/command/postprocessing.go @@ -41,7 +41,7 @@ func RestartPostprocessing(cfg *config.Config) *cli.Command { return configlog.ReturnFatal(parser.ParseConfig(cfg)) }, Action: func(c *cli.Context) error { - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) stream, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Postprocessing.Events)) if err != nil { return err diff --git a/services/postprocessing/pkg/command/server.go b/services/postprocessing/pkg/command/server.go index 326f74f3a78..b426a8ef6e9 100644 --- a/services/postprocessing/pkg/command/server.go +++ b/services/postprocessing/pkg/command/server.go @@ -48,7 +48,7 @@ func Server(cfg *config.Config) *cli.Command { } { - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) bus, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Postprocessing.Events)) if err != nil { return err diff --git a/services/proxy/pkg/command/server.go b/services/proxy/pkg/command/server.go index 77ec3c3db4b..e42b6d0bc87 100644 --- a/services/proxy/pkg/command/server.go +++ b/services/proxy/pkg/command/server.go @@ -157,7 +157,7 @@ func Server(cfg *config.Config) *cli.Command { var publisher events.Stream if cfg.Events.Endpoint != "" { var err error - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) publisher, err = stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { logger.Error(). diff --git a/services/search/pkg/service/grpc/v0/service.go b/services/search/pkg/service/grpc/v0/service.go index 9ba4f3ee7a1..d4f92ab3801 100644 --- a/services/search/pkg/service/grpc/v0/service.go +++ b/services/search/pkg/service/grpc/v0/service.go @@ -80,7 +80,7 @@ func NewHandler(opts ...Option) (searchsvc.SearchProviderHandler, func(), error) return nil, teardown, fmt.Errorf("unknown search extractor: %s", cfg.Extractor.Type) } - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) bus, err := stream.NatsFromConfig(connName, false, stream.NatsConfig{ Endpoint: cfg.Events.Endpoint, Cluster: cfg.Events.Cluster, diff --git a/services/sharing/pkg/revaconfig/config.go b/services/sharing/pkg/revaconfig/config.go index ba7dbb02d59..edaad206ab4 100644 --- a/services/sharing/pkg/revaconfig/config.go +++ b/services/sharing/pkg/revaconfig/config.go @@ -136,7 +136,7 @@ func SharingConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string] "tls-insecure": cfg.Events.TLSInsecure, "tls-root-ca-cert": cfg.Events.TLSRootCaCertPath, "enable-tls": cfg.Events.EnableTLS, - "name": generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS), + "name": generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus), "username": cfg.Events.AuthUsername, "password": cfg.Events.AuthPassword, }, diff --git a/services/sse/pkg/command/server.go b/services/sse/pkg/command/server.go index d0b3d024191..50575c188d7 100644 --- a/services/sse/pkg/command/server.go +++ b/services/sse/pkg/command/server.go @@ -53,7 +53,7 @@ func Server(cfg *config.Config) *cli.Command { } { - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) natsStream, err := stream.NatsFromConfig(connName, true, stream.NatsConfig(cfg.Events)) if err != nil { return err diff --git a/services/storage-users/pkg/event/event.go b/services/storage-users/pkg/event/event.go index c6282d63149..5e7cb36da76 100644 --- a/services/storage-users/pkg/event/event.go +++ b/services/storage-users/pkg/event/event.go @@ -9,7 +9,7 @@ import ( // NewStream prepares the requested nats stream and returns it. func NewStream(cfg *config.Config) (events.Stream, error) { - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) return stream.NatsFromConfig(connName, false, stream.NatsConfig{ Endpoint: cfg.Events.Addr, Cluster: cfg.Events.ClusterID, diff --git a/services/storage-users/pkg/revaconfig/config.go b/services/storage-users/pkg/revaconfig/config.go index 60131003544..2f47e4c5fda 100644 --- a/services/storage-users/pkg/revaconfig/config.go +++ b/services/storage-users/pkg/revaconfig/config.go @@ -58,7 +58,7 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "tls-insecure": cfg.Events.TLSInsecure, "tls-root-ca-cert": cfg.Events.TLSRootCaCertPath, "enable-tls": cfg.Events.EnableTLS, - "name": generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS), + "name": generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus), "username": cfg.Events.AuthUsername, "password": cfg.Events.AuthPassword, }, diff --git a/services/userlog/pkg/command/server.go b/services/userlog/pkg/command/server.go index 96302d94ae2..9b07e54c0bb 100644 --- a/services/userlog/pkg/command/server.go +++ b/services/userlog/pkg/command/server.go @@ -79,7 +79,7 @@ func Server(cfg *config.Config) *cli.Command { defer cancel() - connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS) + connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTypeBus) stream, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Events)) if err != nil { return err