diff --git a/pkg/s3-proxy/bucket/client.go b/pkg/s3-proxy/bucket/client.go index 07905344..8aeff1b5 100644 --- a/pkg/s3-proxy/bucket/client.go +++ b/pkg/s3-proxy/bucket/client.go @@ -7,10 +7,7 @@ import ( "time" "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/config" - "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/log" - "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/metrics" "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/s3client" - "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/tracing" ) // ErrRemovalFolder will be raised when end user is trying to delete a folder and not a file. @@ -50,16 +47,13 @@ type PutInput struct { // NewClient will generate a new client to do GET,PUT or DELETE actions. func NewClient( - tgt *config.TargetConfig, tplConfig *config.TemplateConfig, logger log.Logger, + tgt *config.TargetConfig, mountPath string, - metricsCtx metrics.Client, - parentTrace tracing.Trace, s3clientManager s3client.Manager, ) Client { return &requestContext{ s3ClientManager: s3clientManager, targetCfg: tgt, mountPath: mountPath, - tplConfig: tplConfig, } } diff --git a/pkg/s3-proxy/bucket/requestContext.go b/pkg/s3-proxy/bucket/requestContext.go index 2eafab2c..b6d52981 100644 --- a/pkg/s3-proxy/bucket/requestContext.go +++ b/pkg/s3-proxy/bucket/requestContext.go @@ -17,7 +17,6 @@ import ( type requestContext struct { s3ClientManager s3client.Manager targetCfg *config.TargetConfig - tplConfig *config.TemplateConfig mountPath string } diff --git a/pkg/s3-proxy/server/middlewares/bucket-request-context.go b/pkg/s3-proxy/server/middlewares/bucket-request-context.go index ac9c1777..acd1a2a3 100644 --- a/pkg/s3-proxy/server/middlewares/bucket-request-context.go +++ b/pkg/s3-proxy/server/middlewares/bucket-request-context.go @@ -5,10 +5,7 @@ import ( "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/bucket" "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/config" - "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/log" - "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/metrics" "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/s3client" - "github.com/oxyno-zeta/s3-proxy/pkg/s3-proxy/tracing" "golang.org/x/net/context" ) @@ -23,19 +20,13 @@ var bucketRequestContextKey = &contextKey{name: "bucket-request-context"} func BucketRequestContext( tgt *config.TargetConfig, - tplConfig *config.TemplateConfig, path string, - metricsCli metrics.Client, s3clientManager s3client.Manager, ) func(next http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - // Get logger - logEntry := log.GetLoggerFromContext(req.Context()) - // Get request trace - trace := tracing.GetTraceFromContext(req.Context()) // Generate new bucket client - brctx := bucket.NewClient(tgt, tplConfig, logEntry, path, metricsCli, trace, s3clientManager) + brctx := bucket.NewClient(tgt, path, s3clientManager) // Add bucket structure to request context by creating a new context ctx := context.WithValue(req.Context(), bucketRequestContextKey, brctx) // Create new request with new context diff --git a/pkg/s3-proxy/server/server.go b/pkg/s3-proxy/server/server.go index 65b93e40..7d0fe1b4 100644 --- a/pkg/s3-proxy/server/server.go +++ b/pkg/s3-proxy/server/server.go @@ -239,7 +239,7 @@ func (svr *Server) generateRouter() (http.Handler, error) { rt2.Use(responsehandler.HTTPMiddleware(svr.cfgManager, targetKey)) // Add Bucket request context middleware to initialize it - rt2.Use(middlewares.BucketRequestContext(tgt, cfg.Templates, path, svr.metricsCl, svr.s3clientManager)) + rt2.Use(middlewares.BucketRequestContext(tgt, path, svr.s3clientManager)) // Add authentication middleware to router rt2.Use(authenticationSvc.Middleware(tgt.Resources))