node: hard-code limits for engine API

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
Felix Lange 2023-08-14 17:21:07 +02:00 committed by jsvisa
parent 017ae32fb7
commit 957f1a8ebb
2 changed files with 10 additions and 2 deletions

View file

@ -36,6 +36,13 @@ const (
DefaultAuthPort = 8551 // Default port for the authenticated apis
)
const (
// Engine API batch limits: these are not configurable by users, and should cover the
// needs of all CLs.
engineAPIBatchItemLimit = 2000
engineAPIBatchResponseSizeLimit = 100 * 1000 * 1000
)
var (
DefaultAuthCors = []string{"localhost"} // Default cors domain for the authenticated apis
DefaultAuthVhosts = []string{"localhost"} // Default virtual hosts for the authenticated apis

View file

@ -449,9 +449,10 @@ func (n *Node) startRPC() error {
if err := server.setListenAddr(n.config.AuthAddr, port); err != nil {
return err
}
// Don't limit the requests to the auth endpoint
sharedConfig := rpcEndpointConfig{
jwtSecret: secret,
jwtSecret: secret,
batchItemLimit: engineAPIBatchItemLimit,
batchResponseSizeLimit: engineAPIBatchResponseSizeLimit,
}
if err := server.enableRPC(allAPIs, httpConfig{
CorsAllowedOrigins: DefaultAuthCors,