Config file changes
This commit is contained in:
@@ -33,7 +33,7 @@ impl crate::Config {
|
||||
let mut config = Self {
|
||||
default_language: Language::from_iso_639(
|
||||
settings
|
||||
.value("storage.fts.default-language")
|
||||
.value("storage.full-text.default-language")
|
||||
.unwrap_or("en"),
|
||||
)
|
||||
.unwrap_or(Language::English),
|
||||
@@ -102,7 +102,7 @@ impl crate::Config {
|
||||
rate_authenticated: settings
|
||||
.property_or_static("jmap.rate-limit.account", "1000/1m")?,
|
||||
rate_authenticate_req: settings
|
||||
.property_or_static("jmap.rate-limit.authentication", "10/1m")?,
|
||||
.property_or_static("authentication.rate-limit", "10/1m")?,
|
||||
rate_anonymous: settings.property_or_static("jmap.rate-limit.anonymous", "100/1m")?,
|
||||
rate_use_forwarded: settings
|
||||
.property("jmap.rate-limit.use-forwarded")?
|
||||
@@ -143,7 +143,7 @@ impl crate::Config {
|
||||
.unwrap_or(true),
|
||||
encrypt: settings.property_or_static("storage.encryption.enable", "true")?,
|
||||
encrypt_append: settings.property_or_static("storage.encryption.append", "false")?,
|
||||
spam_header: settings.value("storage.spam.header").and_then(|v| {
|
||||
spam_header: settings.value("spam.header.is-spam").and_then(|v| {
|
||||
v.split_once(':').map(|(k, v)| {
|
||||
(
|
||||
mail_parser::HeaderName::parse(k.trim().to_string()).unwrap(),
|
||||
@@ -152,26 +152,26 @@ impl crate::Config {
|
||||
})
|
||||
}),
|
||||
http_headers: settings
|
||||
.values("jmap.http.headers")
|
||||
.values("server.http.headers")
|
||||
.map(|(_, v)| {
|
||||
if let Some((k, v)) = v.split_once(':') {
|
||||
Ok((
|
||||
hyper::header::HeaderName::from_str(k.trim()).map_err(|err| {
|
||||
format!(
|
||||
"Invalid header found in property \"jmap.http.headers\": {}",
|
||||
"Invalid header found in property \"server.http.headers\": {}",
|
||||
err
|
||||
)
|
||||
})?,
|
||||
hyper::header::HeaderValue::from_str(v.trim()).map_err(|err| {
|
||||
format!(
|
||||
"Invalid header found in property \"jmap.http.headers\": {}",
|
||||
"Invalid header found in property \"server.http.headers\": {}",
|
||||
err
|
||||
)
|
||||
})?,
|
||||
))
|
||||
} else {
|
||||
Err(format!(
|
||||
"Invalid header found in property \"jmap.http.headers\": {}",
|
||||
"Invalid header found in property \"server.http.headers\": {}",
|
||||
v
|
||||
))
|
||||
}
|
||||
|
||||
@@ -191,9 +191,10 @@ impl JMAP {
|
||||
let (state_tx, state_rx) = init_state_manager();
|
||||
let (housekeeper_tx, housekeeper_rx) = init_housekeeper();
|
||||
let shard_amount = config
|
||||
.property::<u64>("global.shared-map.shard")?
|
||||
.property::<u64>("cache.shard")?
|
||||
.unwrap_or(32)
|
||||
.next_power_of_two() as usize;
|
||||
let capacity = config.property("cache.capacity")?.unwrap_or(100);
|
||||
|
||||
let jmap_server = Arc::new(JMAP {
|
||||
directory: directories
|
||||
@@ -213,25 +214,16 @@ impl JMAP {
|
||||
blob_store: stores.get_blob_store(config, "storage.blob")?,
|
||||
lookup_store: stores.get_lookup_store(config, "storage.lookup")?,
|
||||
config: Config::new(config).failed("Invalid configuration file"),
|
||||
sessions: TtlDashMap::with_capacity(
|
||||
config.property("cache.session.size")?.unwrap_or(100),
|
||||
shard_amount,
|
||||
),
|
||||
access_tokens: TtlDashMap::with_capacity(
|
||||
config.property("cache.session.size")?.unwrap_or(100),
|
||||
shard_amount,
|
||||
),
|
||||
sessions: TtlDashMap::with_capacity(capacity, shard_amount),
|
||||
access_tokens: TtlDashMap::with_capacity(capacity, shard_amount),
|
||||
concurrency_limiter: DashMap::with_capacity_and_hasher_and_shard_amount(
|
||||
config.property("cache.rate-limit.size")?.unwrap_or(1024),
|
||||
capacity,
|
||||
RandomState::default(),
|
||||
shard_amount,
|
||||
),
|
||||
oauth_codes: TtlDashMap::with_capacity(
|
||||
config.property("cache.oauth.size")?.unwrap_or(128),
|
||||
shard_amount,
|
||||
),
|
||||
oauth_codes: TtlDashMap::with_capacity(capacity, shard_amount),
|
||||
cache_threads: LruCache::with_capacity(
|
||||
config.property("cache.messages.size")?.unwrap_or(2048),
|
||||
config.property("cache.thread.size")?.unwrap_or(2048),
|
||||
),
|
||||
state_tx,
|
||||
housekeeper_tx,
|
||||
|
||||
Reference in New Issue
Block a user