cryptgeon/src/size.rs

10 lines
319 B
Rust
Raw Normal View History

2021-12-20 17:42:16 +01:00
use actix_web::web;
use byte_unit::Byte;
pub fn init(cfg: &mut web::ServiceConfig) {
let limit_string = std::env::var("SIZE_LIMIT").unwrap_or("1 KiB".to_string());
2021-12-20 17:54:09 +01:00
let limit = Byte::from_str(limit_string).unwrap().get_bytes() as usize;
2021-12-20 17:42:16 +01:00
let config = web::JsonConfig::default().limit(limit);
cfg.data(config);
}