Skip to content
Clone

feat(lib/config): add space config section

ZhenYi committed
parent 5372f63 commit 982eb9c Browse files

2 files changed

+32 −0

File tree 2
Modified lib/config/src/lib.rs View lib/config/src/lib.rs
@@ -5,6 +5,7 @@
55use crate::redis::RedisConfig;
66use crate::s3::S3Config;
77use crate::session::SessionConfig;
8use crate::space::SpaceConfig;
89use crate::user::UserConfig;
910use crate::web::WebConfig;
1011
@@ -20,6 +21,7 @@
2021pub mod mailbaby;
2122pub mod web;
2223pub mod user;
24pub mod space;
2325
2426#[derive(Clone, Debug, Default, Deserialize)]
2527#[serde(default)]
@@ -33,4 +35,5 @@
3335 pub auth: AuthConfig,
3436 pub web: WebConfig,
3537 pub user: UserConfig,
38 pub space: SpaceConfig,
3639}
No newline at end of file
Added lib/config/src/space.rs View lib/config/src/space.rs
@@ -0,0 +1,29 @@
1use serde::Deserialize;
2
3#[derive(Clone, Debug, Deserialize)]
4#[serde(default)]
5pub struct SpaceConfig {
6 pub max_pagination: u64,
7 pub default_pagination: u64,
8 pub max_space_name_len: usize,
9 pub max_space_desc_len: usize,
10 pub max_group_name_len: usize,
11 pub max_alias_name_len: usize,
12 pub max_invite_email_len: usize,
13 pub allow_self_join_groups: bool,
14}
15
16impl Default for SpaceConfig {
17 fn default() -> Self {
18 Self {
19 max_pagination: 100,
20 default_pagination: 20,
21 max_space_name_len: 64,
22 max_space_desc_len: 512,
23 max_group_name_len: 64,
24 max_alias_name_len: 64,
25 max_invite_email_len: 254,
26 allow_self_join_groups: false,
27 }
28 }
29}