diff --git a/pkg/s3-proxy/config/config.go b/pkg/s3-proxy/config/config.go index 74c9c5e9..90c8c00f 100644 --- a/pkg/s3-proxy/config/config.go +++ b/pkg/s3-proxy/config/config.go @@ -9,6 +9,26 @@ import ( // DefaultPort Default port. const DefaultPort = 8080 +// DefaultServerCompressEnabled Default server compress enabled. +var DefaultServerCompressEnabled bool = true + +// DefaultServerCompressLevel Default server compress level. +const DefaultServerCompressLevel = 5 + +// DefaultServerCompressTypes Default server compress types. +var DefaultServerCompressTypes = []string{ + "text/html", + "text/css", + "text/plain", + "text/javascript", + "application/javascript", + "application/x-javascript", + "application/json", + "application/atom+xml", + "application/rss+xml", + "image/svg+xml", +} + // DefaultInternalPort Default internal port. const DefaultInternalPort = 9090 @@ -153,10 +173,18 @@ type TemplateConfig struct { // ServerConfig Server configuration. type ServerConfig struct { - ListenAddr string `mapstructure:"listenAddr"` - Port int `mapstructure:"port" validate:"required"` - CORS *ServerCorsConfig `mapstructure:"cors" validate:"omitempty"` - Cache *CacheConfig `mapstructure:"cache" validate:"omitempty"` + ListenAddr string `mapstructure:"listenAddr"` + Port int `mapstructure:"port" validate:"required"` + CORS *ServerCorsConfig `mapstructure:"cors" validate:"omitempty"` + Cache *CacheConfig `mapstructure:"cache" validate:"omitempty"` + Compress *ServerCompressConfig `mapstructure:"compress" validate:"omitempty"` +} + +// ServerCompressConfig Server compress configuration. +type ServerCompressConfig struct { + Enabled *bool `mapstructure:"enabled"` + Level int `mapstructure:"level" validate:"required,min=1"` + Types []string `mapstructure:"types" validate:"required,min=1"` } // CacheConfig Cache configuration. diff --git a/pkg/s3-proxy/config/managercontext.go b/pkg/s3-proxy/config/managercontext.go index 54768866..852bc295 100644 --- a/pkg/s3-proxy/config/managercontext.go +++ b/pkg/s3-proxy/config/managercontext.go @@ -153,7 +153,13 @@ func (ctx *managercontext) loadDefaultConfigurationValues(vip *viper.Viper) { vip.SetDefault("log.level", DefaultLogLevel) vip.SetDefault("log.format", DefaultLogFormat) vip.SetDefault("server.port", DefaultPort) + vip.SetDefault("server.compress.enabled", &DefaultServerCompressEnabled) + vip.SetDefault("server.compress.level", DefaultServerCompressLevel) + vip.SetDefault("server.compress.types", DefaultServerCompressTypes) vip.SetDefault("internalServer.port", DefaultInternalPort) + vip.SetDefault("internalServer.compress.enabled", &DefaultServerCompressEnabled) + vip.SetDefault("internalServer.compress.level", DefaultServerCompressLevel) + vip.SetDefault("internalServer.compress.types", DefaultServerCompressTypes) vip.SetDefault("templates.folderList", DefaultTemplateFolderListPath) vip.SetDefault("templates.targetList", DefaultTemplateTargetListPath) vip.SetDefault("templates.notFound", DefaultTemplateNotFoundPath) diff --git a/pkg/s3-proxy/config/managercontext_integration_test.go b/pkg/s3-proxy/config/managercontext_integration_test.go index 9f82f275..1be3d4e2 100644 --- a/pkg/s3-proxy/config/managercontext_integration_test.go +++ b/pkg/s3-proxy/config/managercontext_integration_test.go @@ -16,6 +16,13 @@ import ( ) func Test_managercontext_Load(t *testing.T) { + svrCompressCfg := &ServerCompressConfig{ + Enabled: &DefaultServerCompressEnabled, + Level: DefaultServerCompressLevel, + Types: DefaultServerCompressTypes, + } + falseValue := false + tests := []struct { name string configs map[string]string @@ -50,6 +57,68 @@ func Test_managercontext_Load(t *testing.T) { configs: map[string]string{ "config.yaml": ` targets: +- name: test + mount: + path: /test/ + bucket: + name: bucket1 + region: us-east-1 +`, + }, + wantErr: false, + expectedResult: &Config{ + Log: &LogConfig{ + Level: "info", + Format: "json", + }, + Server: &ServerConfig{ + Port: 8080, + Compress: svrCompressCfg, + }, + InternalServer: &ServerConfig{ + Port: 9090, + Compress: svrCompressCfg, + }, + Templates: &TemplateConfig{ + FolderList: "templates/folder-list.tpl", + TargetList: "templates/target-list.tpl", + NotFound: "templates/not-found.tpl", + InternalServerError: "templates/internal-server-error.tpl", + Unauthorized: "templates/unauthorized.tpl", + Forbidden: "templates/forbidden.tpl", + BadRequest: "templates/bad-request.tpl", + }, + Tracing: &TracingConfig{Enabled: false}, + ListTargets: &ListTargetsConfig{ + Enabled: false, + }, + Targets: []*TargetConfig{ + { + Name: "test", + Mount: &MountConfig{ + Path: []string{"/test/"}, + }, + Bucket: &BucketConfig{ + Name: "bucket1", + Region: "us-east-1", + S3ListMaxKeys: 1000, + }, + Actions: &ActionsConfig{ + GET: &GetActionConfig{Enabled: true}, + }, + Templates: &TargetTemplateConfig{}, + }, + }, + }, + }, + { + name: "Test disable server compress", + configs: map[string]string{ + "config.yaml": ` +server: + compress: + enabled: false +targets: - name: test mount: path: /test/ @@ -66,9 +135,15 @@ targets: }, Server: &ServerConfig{ Port: 8080, + Compress: &ServerCompressConfig{ + Enabled: &falseValue, + Level: DefaultServerCompressLevel, + Types: DefaultServerCompressTypes, + }, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -102,6 +177,44 @@ targets: }, }, }, + { + name: "Test server compress configurations error (level)", + configs: map[string]string{ + "config.yaml": ` +server: + compress: + enabled: true + level: 0 +targets: +- name: test + mount: + path: /test/ + bucket: + name: bucket1 + region: us-east-1 +`, + }, + wantErr: true, + }, + { + name: "Test server compress configurations error (types)", + configs: map[string]string{ + "config.yaml": ` +server: + compress: + enabled: true + types: [] +targets: +- name: test + mount: + path: /test/ + bucket: + name: bucket1 + region: us-east-1 +`, + }, + wantErr: true, + }, { name: "Test secrets from environment variable", configs: map[string]string{ @@ -130,10 +243,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -245,10 +360,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -344,10 +461,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -426,10 +545,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -500,10 +621,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -615,6 +738,12 @@ targets: } func Test_Load_reload_config(t *testing.T) { + svrCompressCfg := &ServerCompressConfig{ + Enabled: &DefaultServerCompressEnabled, + Level: DefaultServerCompressLevel, + Types: DefaultServerCompressTypes, + } + // Channel for wait watch waitCh := make(chan bool) @@ -684,10 +813,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -756,10 +887,12 @@ log: Format: "text", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -808,6 +941,12 @@ log: } func Test_Load_reload_secret(t *testing.T) { + svrCompressCfg := &ServerCompressConfig{ + Enabled: &DefaultServerCompressEnabled, + Level: DefaultServerCompressLevel, + Types: DefaultServerCompressTypes, + } + // Channel for wait watch waitCh := make(chan bool) @@ -878,10 +1017,12 @@ targets: Format: "text", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -948,10 +1089,12 @@ targets: Format: "text", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -1000,6 +1143,12 @@ targets: } func Test_Load_reload_config_with_wrong_config(t *testing.T) { + svrCompressCfg := &ServerCompressConfig{ + Enabled: &DefaultServerCompressEnabled, + Level: DefaultServerCompressLevel, + Types: DefaultServerCompressTypes, + } + // Channel for wait watch waitCh := make(chan bool) @@ -1070,10 +1219,12 @@ targets: Format: "text", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -1143,10 +1294,12 @@ configuration with error Format: "text", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -1192,6 +1345,12 @@ configuration with error } func Test_Load_reload_config_map_structure(t *testing.T) { + svrCompressCfg := &ServerCompressConfig{ + Enabled: &DefaultServerCompressEnabled, + Level: DefaultServerCompressLevel, + Types: DefaultServerCompressTypes, + } + // Channel for wait watch waitCh := make(chan bool) @@ -1269,10 +1428,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -1348,10 +1509,12 @@ authProviders: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Templates: &TemplateConfig{ FolderList: "templates/folder-list.tpl", @@ -1405,6 +1568,12 @@ authProviders: } func Test_Load_reload_config_ignore_hidden_file_and_directory(t *testing.T) { + svrCompressCfg := &ServerCompressConfig{ + Enabled: &DefaultServerCompressEnabled, + Level: DefaultServerCompressLevel, + Types: DefaultServerCompressTypes, + } + // Channel for wait watch waitCh := make(chan bool) @@ -1492,10 +1661,12 @@ targets: Format: "json", }, Server: &ServerConfig{ - Port: 8080, + Port: 8080, + Compress: svrCompressCfg, }, InternalServer: &ServerConfig{ - Port: 9090, + Port: 9090, + Compress: svrCompressCfg, }, Tracing: &TracingConfig{Enabled: false}, Templates: &TemplateConfig{ diff --git a/pkg/s3-proxy/server/internal-server.go b/pkg/s3-proxy/server/internal-server.go index 2c60a91d..a26da424 100644 --- a/pkg/s3-proxy/server/internal-server.go +++ b/pkg/s3-proxy/server/internal-server.go @@ -56,20 +56,14 @@ func (svr *InternalServer) generateInternalRouter() http.Handler { // Get configuration cfg := svr.cfgManager.GetConfig() - // A good base middleware stack - r.Use(middleware.Compress( - 5, // nolint: gomnd // No constant for that - "text/html", - "text/css", - "text/plain", - "text/javascript", - "application/javascript", - "application/x-javascript", - "application/json", - "application/atom+xml", - "application/rss+xml", - "image/svg+xml", - )) + // Check if we need to enabled the compress middleware + if *cfg.InternalServer.Compress.Enabled { + r.Use(middleware.Compress( + cfg.InternalServer.Compress.Level, + cfg.InternalServer.Compress.Types..., + )) + } + // Check if no cache is disabled or not if cfg.InternalServer.Cache == nil || cfg.InternalServer.Cache.NoCacheEnabled { // Apply no cache diff --git a/pkg/s3-proxy/server/internal-server_integration_test.go b/pkg/s3-proxy/server/internal-server_integration_test.go index 0a0d9007..d9e415cb 100644 --- a/pkg/s3-proxy/server/internal-server_integration_test.go +++ b/pkg/s3-proxy/server/internal-server_integration_test.go @@ -51,6 +51,11 @@ func TestInternalServer_generateInternalRouter(t *testing.T) { InternalServer: &config.ServerConfig{ ListenAddr: "", Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, }) @@ -106,6 +111,11 @@ func TestInternal_Server_Listen(t *testing.T) { InternalServer: &config.ServerConfig{ ListenAddr: "", Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, }) diff --git a/pkg/s3-proxy/server/server.go b/pkg/s3-proxy/server/server.go index b749d6b5..6d56d339 100644 --- a/pkg/s3-proxy/server/server.go +++ b/pkg/s3-proxy/server/server.go @@ -90,20 +90,14 @@ func (svr *Server) generateRouter() (http.Handler, error) { // Create router r := chi.NewRouter() - // A good base middleware stack - r.Use(middleware.Compress( - 5, // nolint: gomnd // No constant for that - "text/html", - "text/css", - "text/plain", - "text/javascript", - "application/javascript", - "application/x-javascript", - "application/json", - "application/atom+xml", - "application/rss+xml", - "image/svg+xml", - )) + // Check if we need to enabled the compress middleware + if *cfg.Server.Compress.Enabled { + r.Use(middleware.Compress( + cfg.Server.Compress.Level, + cfg.Server.Compress.Types..., + )) + } + // Check if no cache is enabled or not if cfg.Server.Cache == nil || cfg.Server.Cache.NoCacheEnabled { // Apply no cache diff --git a/pkg/s3-proxy/server/server_integration_test.go b/pkg/s3-proxy/server/server_integration_test.go index 65a71f97..5f9d9afc 100644 --- a/pkg/s3-proxy/server/server_integration_test.go +++ b/pkg/s3-proxy/server/server_integration_test.go @@ -46,7 +46,13 @@ func TestPublicRouter(t *testing.T) { } tracingConfig := &config.TracingConfig{} - svrCfg := &config.ServerConfig{} + svrCfg := &config.ServerConfig{ + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, + } type args struct { cfg *config.Config @@ -320,7 +326,8 @@ func TestPublicRouter(t *testing.T) { args: args{ cfg: &config.Config{ Server: &config.ServerConfig{ - Cache: &config.CacheConfig{NoCacheEnabled: true}, + Cache: &config.CacheConfig{NoCacheEnabled: true}, + Compress: svrCfg.Compress, }, ListTargets: &config.ListTargetsConfig{}, Tracing: tracingConfig, @@ -379,6 +386,7 @@ func TestPublicRouter(t *testing.T) { Pragma: "pragma", XAccelExpires: "xaccelexpires", }, + Compress: svrCfg.Compress, }, ListTargets: &config.ListTargetsConfig{}, Tracing: tracingConfig, @@ -2158,7 +2166,13 @@ func TestTracing(t *testing.T) { return } - svrCfg := &config.ServerConfig{} + svrCfg := &config.ServerConfig{ + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, + } tplConfig := &config.TemplateConfig{ FolderList: "../../../templates/folder-list.tpl", TargetList: "../../../templates/target-list.tpl", @@ -2545,6 +2559,11 @@ func TestOIDCAuthentication(t *testing.T) { svrCfg := &config.ServerConfig{ ListenAddr: "", Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, } type jwtToken struct { @@ -3216,6 +3235,11 @@ func TestCORS(t *testing.T) { CORS: &config.ServerCorsConfig{ Enabled: false, }, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3246,6 +3270,11 @@ func TestCORS(t *testing.T) { Enabled: true, AllowAll: true, }, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3279,6 +3308,11 @@ func TestCORS(t *testing.T) { AllowMethods: []string{"GET"}, AllowOrigins: []string{"https://test.fake"}, }, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3312,6 +3346,11 @@ func TestCORS(t *testing.T) { AllowMethods: []string{"GET"}, AllowOrigins: []string{"https://test.fake"}, }, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3345,6 +3384,11 @@ func TestCORS(t *testing.T) { AllowMethods: []string{"GET"}, AllowOrigins: []string{"https://test.*"}, }, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3378,6 +3422,11 @@ func TestCORS(t *testing.T) { AllowMethods: []string{"GET"}, AllowOrigins: []string{"https://test.*"}, }, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3411,6 +3460,11 @@ func TestCORS(t *testing.T) { AllowMethods: []string{"DELETE"}, AllowOrigins: []string{"https://test.*"}, }, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3572,6 +3626,11 @@ func TestIndexLargeBucket(t *testing.T) { cfgManagerMock.EXPECT().GetConfig().AnyTimes().Return(&config.Config{ Server: &config.ServerConfig{ Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3678,6 +3737,11 @@ func TestListLargeBucketAndSmallMaxKeys(t *testing.T) { cfgManagerMock.EXPECT().GetConfig().AnyTimes().Return(&config.Config{ Server: &config.ServerConfig{ Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3783,6 +3847,11 @@ func TestListLargeBucketAndMaxKeysGreaterThanS3MaxKeys(t *testing.T) { cfgManagerMock.EXPECT().GetConfig().AnyTimes().Return(&config.Config{ Server: &config.ServerConfig{ Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3886,6 +3955,11 @@ func TestFolderWithSubFolders(t *testing.T) { cfgManagerMock.EXPECT().GetConfig().AnyTimes().Return(&config.Config{ Server: &config.ServerConfig{ Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, }, ListTargets: &config.ListTargetsConfig{}, Tracing: &config.TracingConfig{}, @@ -3970,6 +4044,11 @@ func TestTrailingSlashRedirect(t *testing.T) { } srvCfg := &config.ServerConfig{ Port: 8080, + Compress: &config.ServerCompressConfig{ + Enabled: &config.DefaultServerCompressEnabled, + Level: config.DefaultServerCompressLevel, + Types: config.DefaultServerCompressTypes, + }, } bucketCfg := &config.BucketConfig{ Name: bucket,