]> Untitled Git - lemmy.git/blob - crates/utils/src/settings/defaults.rs
1333ebe3d7acb6ccd7ec149052dcbd6451bdaaf0
[lemmy.git] / crates / utils / src / settings / defaults.rs
1 use crate::settings::{CaptchaConfig, DatabaseConfig, FederationConfig, RateLimitConfig, Settings};
2 use std::net::{IpAddr, Ipv4Addr};
3
4 impl Default for Settings {
5   fn default() -> Self {
6     Self {
7       database: Some(DatabaseConfig::default()),
8       rate_limit: Some(RateLimitConfig::default()),
9       federation: Some(FederationConfig::default()),
10       captcha: Some(CaptchaConfig::default()),
11       email: None,
12       setup: None,
13       hostname: None,
14       bind: Some(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))),
15       port: Some(8536),
16       tls_enabled: Some(true),
17       jwt_secret: Some("changeme".into()),
18       pictrs_url: Some("http://pictrs:8080".into()),
19       iframely_url: Some("http://iframely".into()),
20       additional_slurs: None,
21       actor_name_max_length: Some(20),
22     }
23   }
24 }
25
26 impl Default for DatabaseConfig {
27   fn default() -> Self {
28     Self {
29       user: Some("lemmy".to_string()),
30       password: "password".into(),
31       host: "localhost".into(),
32       port: Some(5432),
33       database: Some("lemmy".to_string()),
34       pool_size: Some(5),
35     }
36   }
37 }
38
39 impl Default for CaptchaConfig {
40   fn default() -> Self {
41     Self {
42       enabled: true,
43       difficulty: "medium".into(),
44     }
45   }
46 }
47
48 impl Default for FederationConfig {
49   fn default() -> Self {
50     Self {
51       enabled: false,
52       allowed_instances: None,
53       blocked_instances: None,
54       strict_allowlist: Some(true),
55     }
56   }
57 }
58
59 impl Default for RateLimitConfig {
60   fn default() -> Self {
61     Self {
62       message: 180,
63       message_per_second: 60,
64       post: 6,
65       post_per_second: 600,
66       register: 3,
67       register_per_second: 3600,
68       image: 6,
69       image_per_second: 3600,
70     }
71   }
72 }