diff --git a/auth/basic_auth.go b/auth/basic_auth.go index 4bca8bee..6253b10e 100644 --- a/auth/basic_auth.go +++ b/auth/basic_auth.go @@ -1,7 +1,6 @@ package auth import ( - // "fmt" "encoding/base64" "fmt" "net/http" diff --git a/registry/v2/helpers.go b/registry/v2/helpers.go index a3226cff..c2d486df 100644 --- a/registry/v2/helpers.go +++ b/registry/v2/helpers.go @@ -35,18 +35,6 @@ func digest(bz []byte) string { return "sha256:" + hex.EncodeToString(hash.Sum(nil)) } -//func (r *registry) debugf(lm logMsg) { -// -// if r.debug { -// r.echoLogger.Debug(lm) -// } -// -// if r.debug { -// e := r.log.Debug() -// e.Fields(lm).Send() -// } -//} - func (r *registry) getHttpUrlFromSkylink(s string) string { link := strings.TrimPrefix(s, "sia://") return fmt.Sprintf("https://siasky.net/%s", link) diff --git a/registry/v2/registry.go b/registry/v2/registry.go index 7bee0776..14db933d 100644 --- a/registry/v2/registry.go +++ b/registry/v2/registry.go @@ -13,10 +13,9 @@ import ( "sync" "time" - "github.com/containerish/OpenRegistry/telemetry" - "github.com/containerish/OpenRegistry/cache" "github.com/containerish/OpenRegistry/skynet" + "github.com/containerish/OpenRegistry/telemetry" "github.com/containerish/OpenRegistry/types" "github.com/docker/distribution/uuid" "github.com/labstack/echo/v4" diff --git a/registry/v2/types.go b/registry/v2/types.go index b3214033..0ce33d76 100644 --- a/registry/v2/types.go +++ b/registry/v2/types.go @@ -1,12 +1,12 @@ package registry import ( - "github.com/containerish/OpenRegistry/telemetry" "sync" + "github.com/containerish/OpenRegistry/telemetry" + "github.com/containerish/OpenRegistry/cache" "github.com/containerish/OpenRegistry/skynet" - fluentbit "github.com/containerish/OpenRegistry/telemetry/fluent-bit" "github.com/labstack/echo/v4" ) @@ -52,9 +52,9 @@ type RegistryErrors struct { } type RegistryError struct { + Detail map[string]interface{} `json:"detail,omitempty"` Code string `json:"code"` Message string `json:"message"` - Detail map[string]interface{} `json:"detail,omitempty"` } // OCI - Distribution Spec compliant Headers @@ -85,21 +85,20 @@ const ( type ( registry struct { - logger telemetry.Logger - debug bool - skynet *skynet.Client b blobs + logger telemetry.Logger localCache cache.Store + skynet *skynet.Client mu *sync.RWMutex + debug bool } blobs struct { - mutex sync.Mutex - contents map[string][]byte - uploads map[string][]byte - layers map[string][]string - fluentbit fluentbit.FluentBit - registry *registry + mutex sync.Mutex + contents map[string][]byte + uploads map[string][]byte + layers map[string][]string + registry *registry } logMsg map[string]interface{} diff --git a/router/router.go b/router/router.go index b90173cc..260bc594 100644 --- a/router/router.go +++ b/router/router.go @@ -16,7 +16,6 @@ import ( // Register is the entry point that registers all the endpoints // nolint func Register(cfg *config.RegistryConfig, e *echo.Echo, reg registry.Registry, authSvc auth.Authentication, localCache cache.Store) { - e.Use(middleware.Recover()) e.Use(middleware.CORS()) diff --git a/telemetry/log.go b/telemetry/log.go index c2a80688..9b262111 100644 --- a/telemetry/log.go +++ b/telemetry/log.go @@ -11,11 +11,10 @@ import ( "sync" "time" - "github.com/labstack/gommon/log" - fluentbit "github.com/containerish/OpenRegistry/telemetry/fluent-bit" "github.com/containerish/OpenRegistry/types" "github.com/labstack/echo/v4" + "github.com/labstack/gommon/log" "github.com/rs/zerolog" "github.com/valyala/fasttemplate" ) @@ -318,11 +317,11 @@ func (l logger) SetHeader(h string) { } func (l logger) Print(i ...interface{}) { - l.zlog.WithLevel(l.zlog.GetLevel()).Msgf("%v", i) + l.zlog.WithLevel(l.zlog.GetLevel()).Msgf("%v", i...) } func (l logger) Printf(format string, args ...interface{}) { - l.zlog.WithLevel(l.zlog.GetLevel()).Msgf(format, args) + l.zlog.WithLevel(l.zlog.GetLevel()).Msgf(format, args...) } func (l logger) Printj(j log.JSON) { @@ -330,11 +329,11 @@ func (l logger) Printj(j log.JSON) { } func (l logger) Debug(i ...interface{}) { - l.zlog.Debug().Msgf("%v", i) + l.zlog.Debug().Msgf("%v", i...) } func (l logger) Debugf(format string, args ...interface{}) { - l.zlog.Debug().Msgf(format, args) + l.zlog.Debug().Msgf(format, args...) } func (l logger) Debugj(j log.JSON) { @@ -342,11 +341,11 @@ func (l logger) Debugj(j log.JSON) { } func (l logger) Info(i ...interface{}) { - l.zlog.Info().Msgf("%v", i) + l.zlog.Info().Msgf("%v", i...) } func (l logger) Infof(format string, args ...interface{}) { - l.zlog.Info().Msgf(format, args) + l.zlog.Info().Msgf(format, args...) } func (l logger) Infoj(j log.JSON) { @@ -354,11 +353,11 @@ func (l logger) Infoj(j log.JSON) { } func (l logger) Warn(i ...interface{}) { - l.zlog.Warn().Msgf("%v", i) + l.zlog.Warn().Msgf("%v", i...) } func (l logger) Warnf(format string, args ...interface{}) { - l.zlog.Warn().Msgf(format, args) + l.zlog.Warn().Msgf(format, args...) } func (l logger) Warnj(j log.JSON) { @@ -366,11 +365,11 @@ func (l logger) Warnj(j log.JSON) { } func (l logger) Error(i ...interface{}) { - l.zlog.Error().Msgf("%v", i) + l.zlog.Error().Msgf("%v", i...) } func (l logger) Errorf(format string, args ...interface{}) { - l.zlog.Error().Msgf(format, args) + l.zlog.Error().Msgf(format, args...) } func (l logger) Errorj(j log.JSON) { @@ -378,7 +377,7 @@ func (l logger) Errorj(j log.JSON) { } func (l logger) Fatal(i ...interface{}) { - l.zlog.Fatal().Msgf("%v", i) + l.zlog.Fatal().Msgf("%v", i...) } func (l logger) Fatalj(j log.JSON) { @@ -386,11 +385,11 @@ func (l logger) Fatalj(j log.JSON) { } func (l logger) Fatalf(format string, args ...interface{}) { - l.zlog.Fatal().Msgf(format, args) + l.zlog.Fatal().Msgf(format, args...) } func (l logger) Panic(i ...interface{}) { - l.zlog.Panic().Msgf("%v", i) + l.zlog.Panic().Msgf("%v", i...) } func (l logger) Panicj(j log.JSON) { @@ -398,5 +397,5 @@ func (l logger) Panicj(j log.JSON) { } func (l logger) Panicf(format string, args ...interface{}) { - l.zlog.Panic().Msgf(format, args) + l.zlog.Panic().Msgf(format, args...) }