main: set JSON body limit to 50M

* This can happen during import of old backups. Customizations should be
  done in frontend reverse-proxy.
This commit is contained in:
Peter Cai 2020-02-24 12:06:41 +08:00
parent c4e489da56
commit 4a75dfd225
1 changed files with 2 additions and 1 deletions

View File

@ -30,7 +30,7 @@ pub use db::*;
use diesel::prelude::*; use diesel::prelude::*;
use dotenv::dotenv; use dotenv::dotenv;
use rocket::Rocket; use rocket::Rocket;
use rocket::config::{Config, Environment, Value}; use rocket::config::{Config, Environment, Value, Limits};
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
@ -72,6 +72,7 @@ fn get_environment() -> Environment {
fn build_config() -> Config { fn build_config() -> Config {
Config::build(get_environment()) Config::build(get_environment())
.extra("databases", db_config()) .extra("databases", db_config())
.limits(Limits::new().limit("json", 50 * 1024 * 1024))
.finalize() .finalize()
.unwrap() .unwrap()
} }