diff --git a/services/webfinger/pkg/command/server.go b/services/webfinger/pkg/command/server.go index cfba7bf68..adb89f72a 100644 --- a/services/webfinger/pkg/command/server.go +++ b/services/webfinger/pkg/command/server.go @@ -44,17 +44,17 @@ func Server(cfg *config.Config) *cli.Command { } return context.WithCancel(cfg.Context) }() - metrics = metrics.New(metrics.Logger(logger)) + m = metrics.New(metrics.Logger(logger)) ) defer cancel() - metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1) + m.BuildInfo.WithLabelValues(version.GetString()).Set(1) { relationProviders, err := getRelationProviders(cfg) if err != nil { - logger.Error().Err(err).Msg("relation providier init") + logger.Error().Err(err).Msg("relation provider init") return err } @@ -67,7 +67,7 @@ func Server(cfg *config.Config) *cli.Command { logger.Error().Err(err).Msg("handler init") return err } - svc = service.NewInstrument(svc, metrics) + svc = service.NewInstrument(svc, m) svc = service.NewLogging(svc, logger) // this logs service specific data svc = service.NewTracing(svc, traceProvider) diff --git a/services/webfinger/pkg/config/parser/parse.go b/services/webfinger/pkg/config/parser/parse.go index 55d657e93..014f95a27 100644 --- a/services/webfinger/pkg/config/parser/parse.go +++ b/services/webfinger/pkg/config/parser/parse.go @@ -32,6 +32,6 @@ func ParseConfig(cfg *config.Config) error { return Validate(cfg) } -func Validate(cfg *config.Config) error { +func Validate(_ *config.Config) error { return nil } diff --git a/services/webfinger/pkg/relations/openid_discovery.go b/services/webfinger/pkg/relations/openid_discovery.go index 43bae7f9b..53cb315b6 100644 --- a/services/webfinger/pkg/relations/openid_discovery.go +++ b/services/webfinger/pkg/relations/openid_discovery.go @@ -22,7 +22,7 @@ func OpenIDDiscovery(href string) service.RelationProvider { } } -func (l *openIDDiscovery) Add(ctx context.Context, jrd *webfinger.JSONResourceDescriptor) { +func (l *openIDDiscovery) Add(_ context.Context, jrd *webfinger.JSONResourceDescriptor) { if jrd == nil { jrd = &webfinger.JSONResourceDescriptor{} } diff --git a/services/webfinger/pkg/server/debug/server.go b/services/webfinger/pkg/server/debug/server.go index 27719954f..2701befb1 100644 --- a/services/webfinger/pkg/server/debug/server.go +++ b/services/webfinger/pkg/server/debug/server.go @@ -31,7 +31,7 @@ func Server(opts ...Option) (*http.Server, error) { } // health implements the health check. -func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { +func health(_ *config.Config) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) @@ -47,7 +47,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) { } // ready implements the ready check. -func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) { +func ready(_ *config.Config) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) diff --git a/services/webfinger/pkg/server/http/option.go b/services/webfinger/pkg/server/http/option.go index df5d6635b..8846a0788 100644 --- a/services/webfinger/pkg/server/http/option.go +++ b/services/webfinger/pkg/server/http/option.go @@ -2,6 +2,7 @@ package http import ( "context" + "go.opentelemetry.io/otel/trace/noop" "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/services/webfinger/pkg/config" @@ -36,13 +37,6 @@ func newOptions(opts ...Option) Options { return opt } -// Name provides a name for the service. -func Name(val string) Option { - return func(o *Options) { - o.Name = val - } -} - // Logger provides a function to set the logger option. func Logger(val log.Logger) Option { return func(o *Options) { @@ -64,20 +58,6 @@ func Config(val *config.Config) Option { } } -// Flags provides a function to set the flags option. -func Flags(val []cli.Flag) Option { - return func(o *Options) { - o.Flags = append(o.Flags, val...) - } -} - -// Namespace provides a function to set the namespace option. -func Namespace(val string) Option { - return func(o *Options) { - o.Namespace = val - } -} - // Service provides a function to set the service option. func Service(val svc.Service) Option { return func(o *Options) { @@ -91,7 +71,7 @@ func TraceProvider(traceProvider trace.TracerProvider) Option { if traceProvider != nil { o.TraceProvider = traceProvider } else { - o.TraceProvider = trace.NewNoopTracerProvider() + o.TraceProvider = noop.NewTracerProvider() } } } diff --git a/services/webfinger/pkg/server/http/server.go b/services/webfinger/pkg/server/http/server.go index 45e49f76f..2f5553c18 100644 --- a/services/webfinger/pkg/server/http/server.go +++ b/services/webfinger/pkg/server/http/server.go @@ -26,7 +26,7 @@ func Server(opts ...Option) (ohttp.Service, error) { options := newOptions(opts...) service := options.Service - svc, err := ohttp.NewService( + newService, err := ohttp.NewService( ohttp.TLSConfig(options.Config.HTTP.TLS), ohttp.Logger(options.Logger), ohttp.Namespace(options.Config.HTTP.Namespace), @@ -98,13 +98,13 @@ func Server(opts ...Option) (ohttp.Service, error) { r.Get("/.well-known/webfinger", WebfingerHandler(service)) }) - err = micro.RegisterHandler(svc.Server(), mux) + err = micro.RegisterHandler(newService.Server(), mux) if err != nil { options.Logger.Fatal().Err(err).Msg("failed to register the handler") } - svc.Init() - return svc, nil + newService.Init() + return newService, nil } func WebfingerHandler(service svc.Service) func(w http.ResponseWriter, r *http.Request) { diff --git a/services/webfinger/pkg/service/v0/service.go b/services/webfinger/pkg/service/v0/service.go index 238fbbf64..98364fe84 100644 --- a/services/webfinger/pkg/service/v0/service.go +++ b/services/webfinger/pkg/service/v0/service.go @@ -9,11 +9,6 @@ import ( "github.com/owncloud/ocis/v2/services/webfinger/pkg/webfinger" ) -const ( - OwnCloudInstanceRel = "http://webfinger.owncloud/rel/server-instance" - OpenIDConnectRel = "http://openid.net/specs/connect/1.0/issuer" -) - // Service defines the extension handlers. type Service interface { // Webfinger is the endpoint for retrieving various href relations. @@ -78,7 +73,7 @@ type svc struct { } // TODO implement different implementations: -// static one returning the href or a configureable domain +// static one returning the href or a configurable domain // regex one returning different instances based on the regex that matches // claim one that reads a claim and then fetches the instance? // that is actually two interfaces / steps: