2 use serde::Deserialize;
5 #[derive(Debug, Deserialize, Clone, Merge)]
7 pub(crate) database: Option<DatabaseConfig>,
8 pub(crate) rate_limit: Option<RateLimitConfig>,
9 pub(crate) federation: Option<FederationConfig>,
10 pub(crate) hostname: Option<String>,
11 pub(crate) bind: Option<IpAddr>,
12 pub(crate) port: Option<u16>,
13 pub(crate) tls_enabled: Option<bool>,
14 pub(crate) jwt_secret: Option<String>,
15 pub(crate) pictrs_url: Option<String>,
16 pub(crate) iframely_url: Option<String>,
17 pub(crate) captcha: Option<CaptchaConfig>,
18 pub(crate) email: Option<EmailConfig>,
19 pub(crate) setup: Option<SetupConfig>,
22 #[derive(Debug, Deserialize, Clone)]
23 pub struct CaptchaConfig {
25 pub difficulty: String,
28 #[derive(Debug, Deserialize, Clone)]
29 pub struct DatabaseConfig {
30 pub user: Option<String>,
33 pub port: Option<i32>,
34 pub database: Option<String>,
35 pub pool_size: Option<u32>,
38 #[derive(Debug, Deserialize, Clone)]
39 pub struct EmailConfig {
40 pub smtp_server: String,
41 pub smtp_login: Option<String>,
42 pub smtp_password: Option<String>,
43 pub smtp_from_address: String,
47 #[derive(Debug, Deserialize, Clone)]
48 pub struct FederationConfig {
50 pub allowed_instances: Option<Vec<String>>,
51 pub blocked_instances: Option<Vec<String>>,
54 #[derive(Debug, Deserialize, Clone)]
55 pub struct RateLimitConfig {
57 pub message_per_second: i32,
59 pub post_per_second: i32,
61 pub register_per_second: i32,
63 pub image_per_second: i32,
66 #[derive(Debug, Deserialize, Clone)]
67 pub struct SetupConfig {
68 pub admin_username: String,
69 pub admin_password: String,
70 pub admin_email: Option<String>,
71 pub site_name: String,