mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
Merge pull request #684 from MarinPostma/max-payload-size
allow max payload size override
This commit is contained in:
commit
cd1679dea7
@ -1,6 +1,7 @@
|
||||
## v0.10.2
|
||||
|
||||
- Bump sentry version to 0.18.1 (#690)
|
||||
- Enable max payload size override (#684)
|
||||
- Disable sentry in debug (#681)
|
||||
- Better terminal greeting (#680)
|
||||
- Fix highlight misalignment (#679)
|
||||
|
@ -35,6 +35,7 @@ pub struct DataInner {
|
||||
pub db_path: String,
|
||||
pub api_keys: ApiKeys,
|
||||
pub server_pid: Pid,
|
||||
pub http_payload_size_limit: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -137,6 +138,8 @@ impl Data {
|
||||
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 mut api_keys = ApiKeys {
|
||||
@ -152,6 +155,7 @@ impl Data {
|
||||
db_path,
|
||||
api_keys,
|
||||
server_pid,
|
||||
http_payload_size_limit,
|
||||
};
|
||||
|
||||
let data = Data {
|
||||
|
@ -31,7 +31,7 @@ pub fn create_app(
|
||||
.app_data(web::Data::new(data.clone()))
|
||||
.app_data(
|
||||
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
|
||||
.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
|
||||
#[structopt(long, env = "MEILI_UPDATE_MAP_SIZE", default_value = "107374182400")] // 100GB
|
||||
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,
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ impl Server {
|
||||
no_analytics: true,
|
||||
main_map_size: default_db_options.main_map_size,
|
||||
update_map_size: default_db_options.update_map_size,
|
||||
http_payload_size_limit: 10000000,
|
||||
};
|
||||
|
||||
let data = Data::new(opt.clone());
|
||||
|
Loading…
Reference in New Issue
Block a user