WIP
This commit is contained in:
parent
2d4af8fdbb
commit
24691276a9
4 changed files with 31 additions and 12 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -425,7 +425,6 @@ dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"color-print",
|
"color-print",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
|
@ -10,7 +10,6 @@ clap = { version = "4.5", features = ["derive"] }
|
||||||
color-print = "0.3"
|
color-print = "0.3"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
|
||||||
sqlx = { version = "0.7", features = ["runtime-tokio", "postgres"] }
|
sqlx = { version = "0.7", features = ["runtime-tokio", "postgres"] }
|
||||||
tokio = { version = "1.38", features = ["full"] }
|
tokio = { version = "1.38", features = ["full"] }
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
|
|
|
@ -10,11 +10,6 @@ use validator::{Validate, ValidationError};
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Validate, Debug)]
|
#[derive(Deserialize, Serialize, Validate, Debug)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
appearance: Appearance,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Validate, Debug)]
|
|
||||||
pub struct Appearance {
|
|
||||||
/// Server-wide default light theme
|
/// Server-wide default light theme
|
||||||
light_theme: Option<String>,
|
light_theme: Option<String>,
|
||||||
/// Server-wide default light theme
|
/// Server-wide default light theme
|
||||||
|
|
|
@ -8,21 +8,47 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use validator::Validate;
|
use validator::Validate;
|
||||||
|
|
||||||
type Port = u16;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Validate, Debug)]
|
#[derive(Deserialize, Serialize, Validate, Debug)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
info: Option<Info>,
|
||||||
|
timelines: Option<Timelines>,
|
||||||
network: Network,
|
network: Network,
|
||||||
database: Database,
|
database: Database,
|
||||||
cache_server: CacheServer,
|
cache_server: CacheServer,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize, Validate, Debug)]
|
||||||
|
pub struct Info {
|
||||||
|
/// Server name
|
||||||
|
name: Option<String>,
|
||||||
|
/// Server description
|
||||||
|
description: Option<String>,
|
||||||
|
/// Name/handle of the server maintainer
|
||||||
|
maintainer_name: Option<String>,
|
||||||
|
/// Contact info (e.g., email) of the server maintainer
|
||||||
|
contact_info: Option<String>,
|
||||||
|
/// Whether the server allows open self-registration
|
||||||
|
open_registrations: bool,
|
||||||
|
/// Repository URL
|
||||||
|
repository_url: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize, Validate, Debug)]
|
||||||
|
pub struct Timelines {
|
||||||
|
/// Whether to enable the local timeline
|
||||||
|
local: bool,
|
||||||
|
/// Whether to enable the global timeline
|
||||||
|
global: bool,
|
||||||
|
/// Whether to publish the local/global timelines to signed out users
|
||||||
|
guest: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Validate, Debug)]
|
#[derive(Deserialize, Serialize, Validate, Debug)]
|
||||||
pub struct Network {
|
pub struct Network {
|
||||||
protocol: Option<HttpProtocol>,
|
protocol: Option<HttpProtocol>,
|
||||||
host: String,
|
host: String,
|
||||||
port: Port,
|
port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
#[derive(Deserialize, Serialize, Debug)]
|
||||||
|
@ -34,7 +60,7 @@ pub enum HttpProtocol {
|
||||||
#[derive(Deserialize, Serialize, Validate, Debug)]
|
#[derive(Deserialize, Serialize, Validate, Debug)]
|
||||||
pub struct Database {
|
pub struct Database {
|
||||||
host: String,
|
host: String,
|
||||||
port: Port,
|
port: u16,
|
||||||
user: String,
|
user: String,
|
||||||
password: String,
|
password: String,
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -43,7 +69,7 @@ pub struct Database {
|
||||||
#[derive(Deserialize, Serialize, Validate, Debug)]
|
#[derive(Deserialize, Serialize, Validate, Debug)]
|
||||||
pub struct CacheServer {
|
pub struct CacheServer {
|
||||||
host: String,
|
host: String,
|
||||||
port: Port,
|
port: u16,
|
||||||
user: Option<String>,
|
user: Option<String>,
|
||||||
password: Option<String>,
|
password: Option<String>,
|
||||||
index: Option<String>,
|
index: Option<String>,
|
||||||
|
|
Loading…
Reference in a new issue