From f2e41faaf566191011ac9f5c34503ca05d986688 Mon Sep 17 00:00:00 2001 From: thisisnithin Date: Wed, 26 Jun 2024 18:46:52 +0530 Subject: [PATCH 1/2] feat: allow to disable file uploads --- router-tests/file_upload_test.go | 33 +++++++++++++---- router/cmd/instance.go | 1 + router/core/graphql_prehandler.go | 19 ++++++++-- router/core/router.go | 27 +++++++++++--- router/pkg/config/config.go | 11 ++++-- router/pkg/config/config.schema.json | 37 ++++++++++++------- .../pkg/config/testdata/config_defaults.json | 9 +++-- router/pkg/config/testdata/config_full.json | 9 +++-- 8 files changed, 108 insertions(+), 38 deletions(-) diff --git a/router-tests/file_upload_test.go b/router-tests/file_upload_test.go index c271fde7ea..785eb669c2 100644 --- a/router-tests/file_upload_test.go +++ b/router-tests/file_upload_test.go @@ -51,10 +51,10 @@ func TestSingleFileUpload_NoFileProvided(t *testing.T) { func TestFileUpload_FilesSizeExceedsLimit(t *testing.T) { t.Parallel() testenv.Run(t, &testenv.Config{ - RouterOptions: []core.Option{core.WithRouterTrafficConfig(&config.RouterTrafficConfiguration{ - MaxUploadFiles: 1, - MaxRequestBodyBytes: 100, - MaxUploadFileSizeBytes: 50, + RouterOptions: []core.Option{core.WithFileUploadsConfig(&config.FileUploadsRules{ + Enabled: true, + MaxFiles: 1, + MaxFileSizeBytes: 50, })}, }, func(t *testing.T, xEnv *testenv.Environment) { files := make([][]byte, 1) @@ -73,10 +73,10 @@ func TestFileUpload_FilesSizeExceedsLimit(t *testing.T) { func TestFileUpload_FilesExceedsLimit(t *testing.T) { t.Parallel() testenv.Run(t, &testenv.Config{ - RouterOptions: []core.Option{core.WithRouterTrafficConfig(&config.RouterTrafficConfiguration{ - MaxUploadFiles: 2, - MaxRequestBodyBytes: 50000, - MaxUploadFileSizeBytes: 50000, + RouterOptions: []core.Option{core.WithFileUploadsConfig(&config.FileUploadsRules{ + Enabled: true, + MaxFiles: 2, + MaxFileSizeBytes: 50000, })}, }, func(t *testing.T, xEnv *testenv.Environment) { files := make([][]byte, 3) @@ -129,3 +129,20 @@ func TestMultipleFilesUpload_NoFilesProvided(t *testing.T) { require.JSONEq(t, `{"errors":[{"message":"Failed to fetch from Subgraph '0' at Path 'mutation'.","extensions":{"errors":[{"message":"could not render fetch input","path":[]}]}},{"message":"Cannot return null for non-nullable field 'Mutation.multipleUpload'.","path":["multipleUpload"]}],"data":null}`, res.Body) }) } + +func TestFileUpload_UploadsDisabled(t *testing.T) { + t.Parallel() + testenv.Run(t, &testenv.Config{ + RouterOptions: []core.Option{core.WithFileUploadsConfig(&config.FileUploadsRules{ + Enabled: false, + })}, + }, func(t *testing.T, xEnv *testenv.Environment) { + files := make([][]byte, 1) + res := xEnv.MakeGraphQLRequestOK(testenv.GraphQLRequest{ + Query: "mutation($files: [Upload!]!) { multipleUpload(files: $files)}", + Variables: []byte(`{"files":[null]}`), + Files: files, + }) + require.Equal(t, `{"errors":[{"message":"file uploads disabled"}],"data":null}`, res.Body) + }) +} diff --git a/router/cmd/instance.go b/router/cmd/instance.go index 823505df25..da9f6618a8 100644 --- a/router/cmd/instance.go +++ b/router/cmd/instance.go @@ -119,6 +119,7 @@ func NewRouter(params Params, additionalOptions ...core.Option) (*core.Router, e core.WithHeaderRules(cfg.Headers), core.WithStaticRouterConfig(routerConfig), core.WithRouterTrafficConfig(&cfg.TrafficShaping.Router), + core.WithFileUploadsConfig(&cfg.FileUploads), core.WithSubgraphTransportOptions(&core.SubgraphTransportOptions{ RequestTimeout: cfg.TrafficShaping.All.RequestTimeout, ResponseHeaderTimeout: cfg.TrafficShaping.All.ResponseHeaderTimeout, diff --git a/router/core/graphql_prehandler.go b/router/core/graphql_prehandler.go index 0edcc7eda1..96df22dc52 100644 --- a/router/core/graphql_prehandler.go +++ b/router/core/graphql_prehandler.go @@ -47,6 +47,7 @@ type PreHandlerOptions struct { FlushTelemetryAfterResponse bool TraceExportVariables bool SpanAttributesMapper func(r *http.Request) []attribute.KeyValue + FileUploadsEnabled bool MaxUploadFiles int MaxUploadFileSize int } @@ -67,6 +68,7 @@ type PreHandler struct { tracer trace.Tracer traceExportVariables bool spanAttributesMapper func(r *http.Request) []attribute.KeyValue + fileUploadsEnabled bool maxUploadFiles int maxUploadFileSize int } @@ -91,8 +93,9 @@ func NewPreHandler(opts *PreHandlerOptions) *PreHandler { "wundergraph/cosmo/router/pre_handler", trace.WithInstrumentationVersion("0.0.1"), ), - maxUploadFiles: opts.MaxUploadFiles, - maxUploadFileSize: opts.MaxUploadFileSize, + fileUploadsEnabled: opts.FileUploadsEnabled, + maxUploadFiles: opts.MaxUploadFiles, + maxUploadFileSize: opts.MaxUploadFileSize, } } @@ -177,12 +180,12 @@ func (h *PreHandler) Handler(next http.Handler) http.Handler { var body []byte var files []httpclient.File - var err error // XXX: This buffer needs to be returned to the pool only // AFTER we're done with body (retrieved from parser.ReadBody()) buf := pool.GetBytesBuffer() defer pool.PutBytesBuffer(buf) if r.Header.Get("Content-Type") == "" || r.Header.Get("Content-Type") == "application/json" { + var err error body, err = h.operationProcessor.ReadBody(buf, r.Body) if err != nil { finalErr = err @@ -199,8 +202,18 @@ func (h *PreHandler) Handler(next http.Handler) http.Handler { return } } else if strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") { + if !h.fileUploadsEnabled { + finalErr = &inputError{ + message: "file uploads disabled", + statusCode: http.StatusOK, + } + writeOperationError(r, w, requestLogger, finalErr) + return + } + multipartParser := NewMultipartParser(h.operationProcessor, h.maxUploadFiles, h.maxUploadFileSize) + var err error body, files, err = multipartParser.Parse(r, buf) if err != nil { finalErr = err diff --git a/router/core/router.go b/router/core/router.go index 91343a65fe..011434c480 100644 --- a/router/core/router.go +++ b/router/core/router.go @@ -181,6 +181,7 @@ type ( subgraphTransportOptions *SubgraphTransportOptions graphqlMetricsConfig *GraphQLMetricsConfig routerTrafficConfig *config.RouterTrafficConfiguration + fileUploadsConfig *config.FileUploadsRules accessController *AccessController retryOptions retrytransport.RetryOptions redisClient *redis.Client @@ -303,6 +304,9 @@ func NewRouter(opts ...Option) (*Router, error) { if r.routerTrafficConfig == nil { r.routerTrafficConfig = DefaultRouterTrafficConfig() } + if r.fileUploadsConfig == nil { + r.fileUploadsConfig = DefaultFileUploadsConfig() + } if r.accessController == nil { r.accessController = DefaultAccessController() } else { @@ -1342,8 +1346,9 @@ func (r *Router) newServer(ctx context.Context, routerConfig *nodev1.RouterConfi FlushTelemetryAfterResponse: r.awsLambda, TraceExportVariables: r.traceConfig.ExportGraphQLVariables.Enabled, SpanAttributesMapper: r.traceConfig.SpanAttributesMapper, - MaxUploadFiles: r.routerTrafficConfig.MaxUploadFiles, - MaxUploadFileSize: int(r.routerTrafficConfig.MaxUploadFileSizeBytes), + FileUploadsEnabled: r.fileUploadsConfig.Enabled, + MaxUploadFiles: r.fileUploadsConfig.MaxFiles, + MaxUploadFileSize: int(r.fileUploadsConfig.MaxFileSizeBytes), }) graphqlChiRouter := chi.NewRouter() @@ -1820,6 +1825,12 @@ func WithRouterTrafficConfig(cfg *config.RouterTrafficConfiguration) Option { } } +func WithFileUploadsConfig(cfg *config.FileUploadsRules) Option { + return func(r *Router) { + r.fileUploadsConfig = cfg + } +} + func WithAccessController(controller *AccessController) Option { return func(r *Router) { r.accessController = controller @@ -1846,9 +1857,15 @@ func WithLocalhostFallbackInsideDocker(fallback bool) Option { func DefaultRouterTrafficConfig() *config.RouterTrafficConfiguration { return &config.RouterTrafficConfiguration{ - MaxRequestBodyBytes: 1000 * 1000 * 5, // 5 MB - MaxUploadFileSizeBytes: 1000 * 1000 * 50, // 50 MB, - MaxUploadFiles: 10, + MaxRequestBodyBytes: 1000 * 1000 * 5, // 5 MB + } +} + +func DefaultFileUploadsConfig() *config.FileUploadsRules { + return &config.FileUploadsRules{ + Enabled: true, + MaxFileSizeBytes: 1000 * 1000 * 50, // 50 MB, + MaxFiles: 10, } } diff --git a/router/pkg/config/config.go b/router/pkg/config/config.go index 74473ec2a1..cc7549ca97 100644 --- a/router/pkg/config/config.go +++ b/router/pkg/config/config.go @@ -124,11 +124,15 @@ type TrafficShapingRules struct { Router RouterTrafficConfiguration `yaml:"router"` } +type FileUploadsRules struct { + Enabled bool `yaml:"enabled" default:"true"` + MaxFileSizeBytes BytesString `yaml:"max_file_size" default:"50MB"` + MaxFiles int `yaml:"max_files" default:"10"` +} + type RouterTrafficConfiguration struct { // MaxRequestBodyBytes is the maximum size of the request body in bytes - MaxRequestBodyBytes BytesString `yaml:"max_request_body_size" default:"5MB"` - MaxUploadFileSizeBytes BytesString `yaml:"max_upload_file_size" default:"50MB"` - MaxUploadFiles int `yaml:"max_upload_files" default:"10"` + MaxRequestBodyBytes BytesString `yaml:"max_request_body_size" default:"5MB"` } type GlobalSubgraphRequestRule struct { @@ -426,6 +430,7 @@ type Config struct { Modules map[string]interface{} `yaml:"modules,omitempty"` Headers HeaderRules `yaml:"headers,omitempty"` TrafficShaping TrafficShapingRules `yaml:"traffic_shaping,omitempty"` + FileUploads FileUploadsRules `yaml:"file_uploads,omitempty"` ListenAddr string `yaml:"listen_addr" default:"localhost:3002" envconfig:"LISTEN_ADDR"` ControlplaneURL string `yaml:"controlplane_url" default:"https://cosmo-cp.wundergraph.com" envconfig:"CONTROLPLANE_URL"` diff --git a/router/pkg/config/config.schema.json b/router/pkg/config/config.schema.json index e638844d98..ef4b1ae56d 100644 --- a/router/pkg/config/config.schema.json +++ b/router/pkg/config/config.schema.json @@ -624,6 +624,30 @@ "default": "/", "description": "The path of the GraphQL Playground. The GraphQL Playground is a web-based GraphQL IDE that allows you to interact with the GraphQL API. The default value is '/'." }, + "file_uploads": { + "type": "object", + "description": "The configuration for file uploads. Configure whether it should be enabled along with file size and number of files.", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean", + "default": true + }, + "max_file_size": { + "type": "string", + "bytes": { + "minimum": "1MB" + }, + "description": "The maximum size of a file that can be uploaded. The size is specified as a string with a number and a unit, e.g. 10KB, 1MB, 1GB. The supported units are 'KB', 'MB', 'GB'." + }, + "max_files": { + "type": "integer", + "default": 10, + "minimum": 1, + "description": "The maximum number of files that can be uploaded." + } + } + }, "traffic_shaping": { "type": "object", "description": "The configuration for the traffic shaping. Configure rules for traffic shaping like maximum request body size, timeouts, retry behavior, etc. See https://cosmo-docs.wundergraph.com/router/traffic-shaping for more information.", @@ -639,19 +663,6 @@ "minimum": "1MB" }, "description": "The maximum request body size. The size is specified as a string with a number and a unit, e.g. 10KB, 1MB, 1GB. The supported units are 'KB', 'MB', 'GB'." - }, - "max_upload_file_size": { - "type": "string", - "bytes": { - "minimum": "1MB" - }, - "description": "The maximum size of a file that can be uploaded. The size is specified as a string with a number and a unit, e.g. 10KB, 1MB, 1GB. The supported units are 'KB', 'MB', 'GB'." - }, - "max_upload_files": { - "type": "integer", - "default": 10, - "minimum": 1, - "description": "The maximum number of files that can be uploaded." } } }, diff --git a/router/pkg/config/testdata/config_defaults.json b/router/pkg/config/testdata/config_defaults.json index 0d0eea722d..30e21b5e44 100644 --- a/router/pkg/config/testdata/config_defaults.json +++ b/router/pkg/config/testdata/config_defaults.json @@ -104,11 +104,14 @@ "KeepAliveProbeInterval": 30000000000 }, "Router": { - "MaxRequestBodyBytes": 5000000, - "MaxUploadFileSizeBytes": 50000000, - "MaxUploadFiles": 10 + "MaxRequestBodyBytes": 5000000 } }, + "FileUploads": { + "Enabled": true, + "MaxFileSizeBytes": 50000000, + "MaxFiles": 10 + }, "ListenAddr": "localhost:3002", "ControlplaneURL": "https://cosmo-cp.wundergraph.com", "PlaygroundEnabled": true, diff --git a/router/pkg/config/testdata/config_full.json b/router/pkg/config/testdata/config_full.json index baf1a3a8d0..fba0f058e1 100644 --- a/router/pkg/config/testdata/config_full.json +++ b/router/pkg/config/testdata/config_full.json @@ -160,11 +160,14 @@ "KeepAliveProbeInterval": 30000000000 }, "Router": { - "MaxRequestBodyBytes": 5000000, - "MaxUploadFileSizeBytes": 50000000, - "MaxUploadFiles": 10 + "MaxRequestBodyBytes": 5000000 } }, + "FileUploads": { + "Enabled": true, + "MaxFileSizeBytes": 50000000, + "MaxFiles": 10 + }, "ListenAddr": "localhost:3002", "ControlplaneURL": "https://cosmo-cp.wundergraph.com", "PlaygroundEnabled": true, From f901224875ec500b622323929ebab6f8a771f8e9 Mon Sep 17 00:00:00 2001 From: thisisnithin Date: Wed, 26 Jun 2024 19:02:38 +0530 Subject: [PATCH 2/2] improve --- router-tests/file_upload_test.go | 10 +++++----- router/cmd/instance.go | 2 +- router/core/graphql_prehandler.go | 14 ++++++------- router/core/router.go | 20 +++++++++---------- router/pkg/config/config.go | 10 +++++----- router/pkg/config/config.schema.json | 4 ++-- .../pkg/config/testdata/config_defaults.json | 2 +- router/pkg/config/testdata/config_full.json | 2 +- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/router-tests/file_upload_test.go b/router-tests/file_upload_test.go index 785eb669c2..650f79ed9a 100644 --- a/router-tests/file_upload_test.go +++ b/router-tests/file_upload_test.go @@ -51,7 +51,7 @@ func TestSingleFileUpload_NoFileProvided(t *testing.T) { func TestFileUpload_FilesSizeExceedsLimit(t *testing.T) { t.Parallel() testenv.Run(t, &testenv.Config{ - RouterOptions: []core.Option{core.WithFileUploadsConfig(&config.FileUploadsRules{ + RouterOptions: []core.Option{core.WithFileUploadConfig(&config.FileUpload{ Enabled: true, MaxFiles: 1, MaxFileSizeBytes: 50, @@ -73,7 +73,7 @@ func TestFileUpload_FilesSizeExceedsLimit(t *testing.T) { func TestFileUpload_FilesExceedsLimit(t *testing.T) { t.Parallel() testenv.Run(t, &testenv.Config{ - RouterOptions: []core.Option{core.WithFileUploadsConfig(&config.FileUploadsRules{ + RouterOptions: []core.Option{core.WithFileUploadConfig(&config.FileUpload{ Enabled: true, MaxFiles: 2, MaxFileSizeBytes: 50000, @@ -130,10 +130,10 @@ func TestMultipleFilesUpload_NoFilesProvided(t *testing.T) { }) } -func TestFileUpload_UploadsDisabled(t *testing.T) { +func TestFileUpload_UploadDisabled(t *testing.T) { t.Parallel() testenv.Run(t, &testenv.Config{ - RouterOptions: []core.Option{core.WithFileUploadsConfig(&config.FileUploadsRules{ + RouterOptions: []core.Option{core.WithFileUploadConfig(&config.FileUpload{ Enabled: false, })}, }, func(t *testing.T, xEnv *testenv.Environment) { @@ -143,6 +143,6 @@ func TestFileUpload_UploadsDisabled(t *testing.T) { Variables: []byte(`{"files":[null]}`), Files: files, }) - require.Equal(t, `{"errors":[{"message":"file uploads disabled"}],"data":null}`, res.Body) + require.Equal(t, `{"errors":[{"message":"file upload disabled"}],"data":null}`, res.Body) }) } diff --git a/router/cmd/instance.go b/router/cmd/instance.go index da9f6618a8..4c927151fc 100644 --- a/router/cmd/instance.go +++ b/router/cmd/instance.go @@ -119,7 +119,7 @@ func NewRouter(params Params, additionalOptions ...core.Option) (*core.Router, e core.WithHeaderRules(cfg.Headers), core.WithStaticRouterConfig(routerConfig), core.WithRouterTrafficConfig(&cfg.TrafficShaping.Router), - core.WithFileUploadsConfig(&cfg.FileUploads), + core.WithFileUploadConfig(&cfg.FileUpload), core.WithSubgraphTransportOptions(&core.SubgraphTransportOptions{ RequestTimeout: cfg.TrafficShaping.All.RequestTimeout, ResponseHeaderTimeout: cfg.TrafficShaping.All.ResponseHeaderTimeout, diff --git a/router/core/graphql_prehandler.go b/router/core/graphql_prehandler.go index 96df22dc52..b83ce9a7b5 100644 --- a/router/core/graphql_prehandler.go +++ b/router/core/graphql_prehandler.go @@ -47,7 +47,7 @@ type PreHandlerOptions struct { FlushTelemetryAfterResponse bool TraceExportVariables bool SpanAttributesMapper func(r *http.Request) []attribute.KeyValue - FileUploadsEnabled bool + FileUploadEnabled bool MaxUploadFiles int MaxUploadFileSize int } @@ -68,7 +68,7 @@ type PreHandler struct { tracer trace.Tracer traceExportVariables bool spanAttributesMapper func(r *http.Request) []attribute.KeyValue - fileUploadsEnabled bool + fileUploadEnabled bool maxUploadFiles int maxUploadFileSize int } @@ -93,9 +93,9 @@ func NewPreHandler(opts *PreHandlerOptions) *PreHandler { "wundergraph/cosmo/router/pre_handler", trace.WithInstrumentationVersion("0.0.1"), ), - fileUploadsEnabled: opts.FileUploadsEnabled, - maxUploadFiles: opts.MaxUploadFiles, - maxUploadFileSize: opts.MaxUploadFileSize, + fileUploadEnabled: opts.FileUploadEnabled, + maxUploadFiles: opts.MaxUploadFiles, + maxUploadFileSize: opts.MaxUploadFileSize, } } @@ -202,9 +202,9 @@ func (h *PreHandler) Handler(next http.Handler) http.Handler { return } } else if strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") { - if !h.fileUploadsEnabled { + if !h.fileUploadEnabled { finalErr = &inputError{ - message: "file uploads disabled", + message: "file upload disabled", statusCode: http.StatusOK, } writeOperationError(r, w, requestLogger, finalErr) diff --git a/router/core/router.go b/router/core/router.go index 011434c480..85ef93279f 100644 --- a/router/core/router.go +++ b/router/core/router.go @@ -181,7 +181,7 @@ type ( subgraphTransportOptions *SubgraphTransportOptions graphqlMetricsConfig *GraphQLMetricsConfig routerTrafficConfig *config.RouterTrafficConfiguration - fileUploadsConfig *config.FileUploadsRules + fileUploadConfig *config.FileUpload accessController *AccessController retryOptions retrytransport.RetryOptions redisClient *redis.Client @@ -304,8 +304,8 @@ func NewRouter(opts ...Option) (*Router, error) { if r.routerTrafficConfig == nil { r.routerTrafficConfig = DefaultRouterTrafficConfig() } - if r.fileUploadsConfig == nil { - r.fileUploadsConfig = DefaultFileUploadsConfig() + if r.fileUploadConfig == nil { + r.fileUploadConfig = DefaultFileUploadConfig() } if r.accessController == nil { r.accessController = DefaultAccessController() @@ -1346,9 +1346,9 @@ func (r *Router) newServer(ctx context.Context, routerConfig *nodev1.RouterConfi FlushTelemetryAfterResponse: r.awsLambda, TraceExportVariables: r.traceConfig.ExportGraphQLVariables.Enabled, SpanAttributesMapper: r.traceConfig.SpanAttributesMapper, - FileUploadsEnabled: r.fileUploadsConfig.Enabled, - MaxUploadFiles: r.fileUploadsConfig.MaxFiles, - MaxUploadFileSize: int(r.fileUploadsConfig.MaxFileSizeBytes), + FileUploadEnabled: r.fileUploadConfig.Enabled, + MaxUploadFiles: r.fileUploadConfig.MaxFiles, + MaxUploadFileSize: int(r.fileUploadConfig.MaxFileSizeBytes), }) graphqlChiRouter := chi.NewRouter() @@ -1825,9 +1825,9 @@ func WithRouterTrafficConfig(cfg *config.RouterTrafficConfiguration) Option { } } -func WithFileUploadsConfig(cfg *config.FileUploadsRules) Option { +func WithFileUploadConfig(cfg *config.FileUpload) Option { return func(r *Router) { - r.fileUploadsConfig = cfg + r.fileUploadConfig = cfg } } @@ -1861,8 +1861,8 @@ func DefaultRouterTrafficConfig() *config.RouterTrafficConfiguration { } } -func DefaultFileUploadsConfig() *config.FileUploadsRules { - return &config.FileUploadsRules{ +func DefaultFileUploadConfig() *config.FileUpload { + return &config.FileUpload{ Enabled: true, MaxFileSizeBytes: 1000 * 1000 * 50, // 50 MB, MaxFiles: 10, diff --git a/router/pkg/config/config.go b/router/pkg/config/config.go index cc7549ca97..f4b1f00a79 100644 --- a/router/pkg/config/config.go +++ b/router/pkg/config/config.go @@ -124,10 +124,10 @@ type TrafficShapingRules struct { Router RouterTrafficConfiguration `yaml:"router"` } -type FileUploadsRules struct { - Enabled bool `yaml:"enabled" default:"true"` - MaxFileSizeBytes BytesString `yaml:"max_file_size" default:"50MB"` - MaxFiles int `yaml:"max_files" default:"10"` +type FileUpload struct { + Enabled bool `yaml:"enabled" default:"true" envconfig:"FILE_UPLOAD_ENABLED"` + MaxFileSizeBytes BytesString `yaml:"max_file_size" default:"50MB" envconfig:"FILE_UPLOAD_MAX_FILE_SIZE"` + MaxFiles int `yaml:"max_files" default:"10" envconfig:"FILE_UPLOAD_MAX_FILES"` } type RouterTrafficConfiguration struct { @@ -430,7 +430,7 @@ type Config struct { Modules map[string]interface{} `yaml:"modules,omitempty"` Headers HeaderRules `yaml:"headers,omitempty"` TrafficShaping TrafficShapingRules `yaml:"traffic_shaping,omitempty"` - FileUploads FileUploadsRules `yaml:"file_uploads,omitempty"` + FileUpload FileUpload `yaml:"file_upload,omitempty"` ListenAddr string `yaml:"listen_addr" default:"localhost:3002" envconfig:"LISTEN_ADDR"` ControlplaneURL string `yaml:"controlplane_url" default:"https://cosmo-cp.wundergraph.com" envconfig:"CONTROLPLANE_URL"` diff --git a/router/pkg/config/config.schema.json b/router/pkg/config/config.schema.json index ef4b1ae56d..f49fcc96e2 100644 --- a/router/pkg/config/config.schema.json +++ b/router/pkg/config/config.schema.json @@ -624,9 +624,9 @@ "default": "/", "description": "The path of the GraphQL Playground. The GraphQL Playground is a web-based GraphQL IDE that allows you to interact with the GraphQL API. The default value is '/'." }, - "file_uploads": { + "file_upload": { "type": "object", - "description": "The configuration for file uploads. Configure whether it should be enabled along with file size and number of files.", + "description": "The configuration for file upload. Configure whether it should be enabled along with file size and number of files.", "additionalProperties": false, "properties": { "enabled": { diff --git a/router/pkg/config/testdata/config_defaults.json b/router/pkg/config/testdata/config_defaults.json index 30e21b5e44..75f392928d 100644 --- a/router/pkg/config/testdata/config_defaults.json +++ b/router/pkg/config/testdata/config_defaults.json @@ -107,7 +107,7 @@ "MaxRequestBodyBytes": 5000000 } }, - "FileUploads": { + "FileUpload": { "Enabled": true, "MaxFileSizeBytes": 50000000, "MaxFiles": 10 diff --git a/router/pkg/config/testdata/config_full.json b/router/pkg/config/testdata/config_full.json index fba0f058e1..fcd1717c4d 100644 --- a/router/pkg/config/testdata/config_full.json +++ b/router/pkg/config/testdata/config_full.json @@ -163,7 +163,7 @@ "MaxRequestBodyBytes": 5000000 } }, - "FileUploads": { + "FileUpload": { "Enabled": true, "MaxFileSizeBytes": 50000000, "MaxFiles": 10