mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-10-26 02:16:15 +03:00
Add Batch Limits to API limits config
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10556 GitOrigin-RevId: a4ff69dfc0b1651e0376aa60545a0b0b7d6ee41d
This commit is contained in:
parent
7fd9f0fd7c
commit
0ff034cb87
@ -50,6 +50,7 @@ type apiLimitsObject struct {
|
||||
DepthLimit yaml.Node `yaml:"depth_limit,omitempty"`
|
||||
NodeLimit yaml.Node `yaml:"node_limit,omitempty"`
|
||||
TimeLimit yaml.Node `yaml:"time_limit,omitempty"`
|
||||
BatchLimit yaml.Node `yaml:"batch_limit,omitempty"`
|
||||
}
|
||||
|
||||
func (o *MetadataObject) Build() (map[string]interface{}, error) {
|
||||
|
@ -101,10 +101,29 @@ func TestMetadataObject_Export(t *testing.T) {
|
||||
map[string][]byte{
|
||||
"testdata/export_test/api_limits.yaml": []byte(`disabled: false
|
||||
rate_limit:
|
||||
per_role: {}
|
||||
global:
|
||||
max_reqs_per_min: 30
|
||||
unique_params: IP
|
||||
max_reqs_per_min: 1
|
||||
per_role:
|
||||
user:
|
||||
max_reqs_per_min: 10
|
||||
unique_params: null
|
||||
depth_limit:
|
||||
global: 5
|
||||
per_role:
|
||||
user: 2
|
||||
node_limit:
|
||||
global: 5
|
||||
per_role:
|
||||
user: 2
|
||||
time_limit:
|
||||
global: 30
|
||||
per_role:
|
||||
user: 10
|
||||
batch_limit:
|
||||
global: 5
|
||||
per_role:
|
||||
user: 2
|
||||
`)},
|
||||
false,
|
||||
require.NoError,
|
||||
|
@ -1,6 +1,25 @@
|
||||
batch_limit:
|
||||
global: 5
|
||||
per_role:
|
||||
user: 2
|
||||
depth_limit:
|
||||
global: 5
|
||||
per_role:
|
||||
user: 2
|
||||
disabled: false
|
||||
node_limit:
|
||||
global: 5
|
||||
per_role:
|
||||
user: 2
|
||||
rate_limit:
|
||||
per_role: {}
|
||||
global:
|
||||
max_reqs_per_min: 30
|
||||
unique_params: IP
|
||||
max_reqs_per_min: 1
|
||||
per_role:
|
||||
user:
|
||||
max_reqs_per_min: 10
|
||||
unique_params: null
|
||||
time_limit:
|
||||
global: 30
|
||||
per_role:
|
||||
user: 10
|
||||
|
@ -1 +1 @@
|
||||
{"api_limits": {"disabled": false, "rate_limit": {"per_role": {}, "global": {"unique_params": "IP", "max_reqs_per_min": 1}}}}
|
||||
{"api_limits": {"disabled": false, "rate_limit": {"global": {"max_reqs_per_min": 30, "unique_params": "IP"}, "per_role": {"user": {"max_reqs_per_min": 10, "unique_params": null}}}, "depth_limit": {"global": 5, "per_role": {"user": 2}}, "node_limit": {"global": 5, "per_role": {"user": 2}}, "time_limit": {"global": 30, "per_role": {"user": 10}}, "batch_limit": {"global": 5, "per_role": {"user": 2}}}}
|
||||
|
@ -4,11 +4,14 @@
|
||||
"api_limits": {
|
||||
"disabled": false,
|
||||
"rate_limit": {
|
||||
"per_role": {},
|
||||
"global": {
|
||||
"unique_params": "IP",
|
||||
"max_reqs_per_min": 1
|
||||
"global": { "max_reqs_per_min": 30, "unique_params": "IP" },
|
||||
"per_role": {
|
||||
"user": { "max_reqs_per_min": 10, "unique_params": null }
|
||||
}
|
||||
}
|
||||
},
|
||||
"depth_limit": { "global": 5, "per_role": { "user": 2 } },
|
||||
"node_limit": { "global": 5, "per_role": { "user": 2 } },
|
||||
"time_limit": { "global": 30, "per_role": { "user": 10 } },
|
||||
"batch_limit": { "global": 5, "per_role": { "user": 2 } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user