mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-06-10 01:19:21 +00:00
6ffa291ec9
* Make length of user/community name configurable (fixes #1306) * use single config value, fix migrations, increase displayname length * remove debug statements * add helper method for setting actor_name_max_length * move function * Fixing some defaults Co-authored-by: Felix Ableitner <me@nutomic.com>
73 lines
1.7 KiB
Rust
73 lines
1.7 KiB
Rust
use crate::settings::{CaptchaConfig, DatabaseConfig, FederationConfig, RateLimitConfig, Settings};
|
|
use std::net::{IpAddr, Ipv4Addr};
|
|
|
|
impl Default for Settings {
|
|
fn default() -> Self {
|
|
Self {
|
|
database: Some(DatabaseConfig::default()),
|
|
rate_limit: Some(RateLimitConfig::default()),
|
|
federation: Some(FederationConfig::default()),
|
|
captcha: Some(CaptchaConfig::default()),
|
|
email: None,
|
|
setup: None,
|
|
hostname: None,
|
|
bind: Some(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))),
|
|
port: Some(8536),
|
|
tls_enabled: Some(true),
|
|
jwt_secret: Some("changeme".into()),
|
|
pictrs_url: Some("http://pictrs:8080".into()),
|
|
iframely_url: Some("http://iframely".into()),
|
|
additional_slurs: None,
|
|
actor_name_max_length: Some(20),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Default for DatabaseConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
user: Some("lemmy".to_string()),
|
|
password: "password".into(),
|
|
host: "localhost".into(),
|
|
port: Some(5432),
|
|
database: Some("lemmy".to_string()),
|
|
pool_size: Some(5),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Default for CaptchaConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
enabled: true,
|
|
difficulty: "medium".into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Default for FederationConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
enabled: false,
|
|
allowed_instances: None,
|
|
blocked_instances: None,
|
|
strict_allowlist: Some(true),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Default for RateLimitConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
message: 180,
|
|
message_per_second: 60,
|
|
post: 6,
|
|
post_per_second: 600,
|
|
register: 3,
|
|
register_per_second: 3600,
|
|
image: 6,
|
|
image_per_second: 3600,
|
|
}
|
|
}
|
|
}
|