diff --git a/configuration/config.go b/configuration/config.go index 22d9fcfd884567b26fc111167fce3b0ce9639ff1..4943459deb412304670a8293e3ec4cfa0e1671a4 100644 --- a/configuration/config.go +++ b/configuration/config.go @@ -8,6 +8,9 @@ import ( ) +const BODY_SIZE_LIMIT = 32 * 1024 * 1024 // 32 MB, in bytes + + type Config struct { Environment string `env:"ENV_NAME" envDefault:"development"` Host string `env:"HOST" envDefault:"127.0.0.1"` diff --git a/main.go b/main.go index cacfd7338e4a545ffa20bb791bdad64eec7fa3b0..f9bbd9f78a00de4da63c04585b73427bfc8a9ea9 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ func main() { server := fiber.New( fiber.Config{ AppName: "webservice", DisableStartupMessage: config.Environment != "development", + BodyLimit: configuration.BODY_SIZE_LIMIT, }) var store state.Store diff --git a/routing/routes_test.go b/routing/routes_test.go index c7295c855e9e4509280a1f44c2792aed68574807..bc1cdd8f1aa179ee2096283feeb409da69ed1df2 100644 --- a/routing/routes_test.go +++ b/routing/routes_test.go @@ -28,6 +28,7 @@ func setup() ( *f.App, *configuration.Config, state.Store, *bool ){ server := f.New( f.Config{ AppName: "test", DisableStartupMessage: false, + BodyLimit: configuration.BODY_SIZE_LIMIT, }) store := state.NewEphemeralStore() var isHealthy = true