mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 18:45:06 +08:00
allow max payload size override
This commit is contained in:
parent
e40d9e7462
commit
5193382b07
@ -35,6 +35,7 @@ pub struct DataInner {
|
|||||||
pub db_path: String,
|
pub db_path: String,
|
||||||
pub api_keys: ApiKeys,
|
pub api_keys: ApiKeys,
|
||||||
pub server_pid: Pid,
|
pub server_pid: Pid,
|
||||||
|
pub http_payload_size_limit: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -137,6 +138,8 @@ impl Data {
|
|||||||
update_map_size: opt.update_map_size,
|
update_map_size: opt.update_map_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let http_payload_size_limit = opt.http_payload_size_limit;
|
||||||
|
|
||||||
let db = Arc::new(Database::open_or_create(opt.db_path, db_opt).unwrap());
|
let db = Arc::new(Database::open_or_create(opt.db_path, db_opt).unwrap());
|
||||||
|
|
||||||
let mut api_keys = ApiKeys {
|
let mut api_keys = ApiKeys {
|
||||||
@ -152,6 +155,7 @@ impl Data {
|
|||||||
db_path,
|
db_path,
|
||||||
api_keys,
|
api_keys,
|
||||||
server_pid,
|
server_pid,
|
||||||
|
http_payload_size_limit,
|
||||||
};
|
};
|
||||||
|
|
||||||
let data = Data {
|
let data = Data {
|
||||||
|
@ -31,7 +31,7 @@ pub fn create_app(
|
|||||||
.app_data(web::Data::new(data.clone()))
|
.app_data(web::Data::new(data.clone()))
|
||||||
.app_data(
|
.app_data(
|
||||||
web::JsonConfig::default()
|
web::JsonConfig::default()
|
||||||
.limit(1024 * 1024 * 10) // Json Limit of 10Mb
|
.limit(data.http_payload_size_limit)
|
||||||
.content_type(|_mime| true) // Accept all mime types
|
.content_type(|_mime| true) // Accept all mime types
|
||||||
.error_handler(|err, _req| json_error_handler(err).into()),
|
.error_handler(|err, _req| json_error_handler(err).into()),
|
||||||
)
|
)
|
||||||
|
@ -34,4 +34,8 @@ pub struct Opt {
|
|||||||
/// The maximum size, in bytes, of the update lmdb database directory
|
/// The maximum size, in bytes, of the update lmdb database directory
|
||||||
#[structopt(long, env = "MEILI_UPDATE_MAP_SIZE", default_value = "107374182400")] // 100GB
|
#[structopt(long, env = "MEILI_UPDATE_MAP_SIZE", default_value = "107374182400")] // 100GB
|
||||||
pub update_map_size: usize,
|
pub update_map_size: usize,
|
||||||
|
|
||||||
|
/// The maximum size, in bytes, of accepted JSON payloads
|
||||||
|
#[structopt(long, env = "MEILI_HTTP_PAYLOAD_SIZE_LIMIT", default_value = "10485760")] // 10MB
|
||||||
|
pub http_payload_size_limit: usize,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user