diff --git a/cmd/gate/app.go b/cmd/gate/app.go index 8ec71ee13..3de224504 100644 --- a/cmd/gate/app.go +++ b/cmd/gate/app.go @@ -4,9 +4,11 @@ import ( "context" "net" "net/http" + "os" "time" minio "github.com/minio/minio/legacy" + "github.com/minio/minio/legacy/config" "github.com/minio/minio/neofs/layer" "github.com/minio/minio/neofs/pool" "github.com/minio/minio/pkg/auth" @@ -106,9 +108,19 @@ func newApp(l *zap.Logger, v *viper.Viper) *App { zap.Error(err)) } - l.Info("credentials", - zap.String("AccessKey", uid.String()), - zap.String("SecretKey", wif)) + { // Temporary solution, to resolve problems with MinIO GW access/secret keys: + if err = os.Setenv(config.EnvAccessKey, uid.String()); err != nil { + l.Fatal("could not set "+config.EnvAccessKey, + zap.Error(err)) + } else if err = os.Setenv(config.EnvSecretKey, wif); err != nil { + l.Fatal("could not set "+config.EnvSecretKey, + zap.Error(err)) + } + + l.Info("used credentials", + zap.String("AccessKey", uid.String()), + zap.String("SecretKey", wif)) + } if obj, err = layer.NewLayer(cli, auth.Credentials{AccessKey: uid.String(), SecretKey: wif}); err != nil { l.Fatal("could not prepare ObjectLayer", @@ -167,7 +179,7 @@ func (a *App) Server(ctx context.Context) { attachProfiler(router, a.cfg, a.log) // Attach S3 API: - minio.AttachS3API(router, a.obj) + minio.AttachS3API(router, a.obj, a.log) // Use mux.Router as http.Handler srv.Handler = router diff --git a/legacy/neofs-router.go b/legacy/neofs-router.go index 5ce9c2a9d..28b759b86 100644 --- a/legacy/neofs-router.go +++ b/legacy/neofs-router.go @@ -2,9 +2,10 @@ package legacy import ( "github.com/gorilla/mux" + "go.uber.org/zap" ) -func AttachS3API(r *mux.Router, obj ObjectLayer) { +func AttachS3API(r *mux.Router, obj ObjectLayer, l *zap.Logger) { // Add healthcheck router registerHealthCheckRouter(r) @@ -34,4 +35,13 @@ func AttachS3API(r *mux.Router, obj ObjectLayer) { globalObjLayerMutex.Lock() globalSafeMode = false globalObjLayerMutex.Unlock() + + // Handle gateway specific env + gatewayHandleEnvVars() + + // Set system resources to maximum. + if err := setMaxResources(); err != nil { + l.Warn("could not set max resources", + zap.Error(err)) + } }