update library

auto-generate-config-docs
Felix Ableitner 2021-09-27 11:36:45 +02:00
parent 79a7721867
commit 700f4eeead
5 changed files with 21 additions and 15 deletions

9
Cargo.lock generated
View File

@ -1002,16 +1002,17 @@ checksum = "31ad93652f40969dead8d4bf897a41e9462095152eb21c56e5830537e41179dd"
[[package]] [[package]]
name = "doku" name = "doku"
version = "0.9.0" version = "0.10.0"
source = "git+https://github.com/anixe/doku?branch=issue/1#97e58175aa2972c003a8155d6f58aca91a9bfe88" source = "git+https://github.com/anixe/doku?branch=v0.10#7397e8fac5cd08585b87546a768903365fa8b8c8"
dependencies = [ dependencies = [
"doku-derive", "doku-derive",
"serde",
] ]
[[package]] [[package]]
name = "doku-derive" name = "doku-derive"
version = "0.9.0" version = "0.10.0"
source = "git+https://github.com/anixe/doku?branch=issue/1#97e58175aa2972c003a8155d6f58aca91a9bfe88" source = "git+https://github.com/anixe/doku?branch=v0.10#7397e8fac5cd08585b87546a768903365fa8b8c8"
dependencies = [ dependencies = [
"darling 0.13.0", "darling 0.13.0",
"proc-macro-error", "proc-macro-error",

View File

@ -64,7 +64,7 @@ activitystreams = "0.7.0-alpha.11"
actix-rt = { version = "2.2.0", default-features = false } actix-rt = { version = "2.2.0", default-features = false }
serde_json = { version = "1.0.68", features = ["preserve_order"] } serde_json = { version = "1.0.68", features = ["preserve_order"] }
clokwerk = "0.3.5" clokwerk = "0.3.5"
doku = { git = "https://github.com/anixe/doku", branch = "issue/1" } doku = { git = "https://github.com/anixe/doku", branch = "v0.10" }
[dev-dependencies.cargo-husky] [dev-dependencies.cargo-husky]
version = "1.5.0" version = "1.5.0"

View File

@ -39,4 +39,4 @@ deser-hjson = "1.0.2"
smart-default = "0.6.0" smart-default = "0.6.0"
webpage = { version = "1.3.0", default-features = false, features = ["serde"] } webpage = { version = "1.3.0", default-features = false, features = ["serde"] }
jsonwebtoken = "7.2.0" jsonwebtoken = "7.2.0"
doku = { git = "https://github.com/anixe/doku", branch = "issue/1" } doku = { git = "https://github.com/anixe/doku", branch = "v0.10" }

View File

@ -1,8 +1,8 @@
use doku::prelude::*; use doku::prelude::*;
use serde::Deserialize; use serde::{Deserialize, Serialize};
use std::net::{IpAddr, Ipv4Addr}; use std::net::{IpAddr, Ipv4Addr};
#[derive(Debug, Deserialize, Clone, SmartDefault, Doku)] #[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
#[serde(default)] #[serde(default)]
pub struct Settings { pub struct Settings {
#[serde(default)] #[serde(default)]
@ -36,7 +36,7 @@ pub struct Settings {
pub actor_name_max_length: usize, pub actor_name_max_length: usize,
} }
#[derive(Debug, Deserialize, Clone, SmartDefault, Doku)] #[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
#[serde(default)] #[serde(default)]
pub struct CaptchaConfig { pub struct CaptchaConfig {
#[default(false)] #[default(false)]
@ -45,7 +45,7 @@ pub struct CaptchaConfig {
pub difficulty: String, pub difficulty: String,
} }
#[derive(Debug, Deserialize, Clone, SmartDefault, Doku)] #[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
#[serde(default)] #[serde(default)]
pub struct DatabaseConfig { pub struct DatabaseConfig {
#[default("lemmy")] #[default("lemmy")]
@ -62,7 +62,7 @@ pub struct DatabaseConfig {
pub pool_size: u32, pub pool_size: u32,
} }
#[derive(Debug, Deserialize, Clone, Doku)] #[derive(Debug, Deserialize, Serialize, Clone, Document)]
pub struct EmailConfig { pub struct EmailConfig {
#[doku(example = "localhost:25")] #[doku(example = "localhost:25")]
pub smtp_server: String, pub smtp_server: String,
@ -73,7 +73,7 @@ pub struct EmailConfig {
pub use_tls: bool, pub use_tls: bool,
} }
#[derive(Debug, Deserialize, Clone, SmartDefault, Doku)] #[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
#[serde(default)] #[serde(default)]
pub struct FederationConfig { pub struct FederationConfig {
#[default(false)] #[default(false)]
@ -86,7 +86,7 @@ pub struct FederationConfig {
pub strict_allowlist: bool, pub strict_allowlist: bool,
} }
#[derive(Debug, Deserialize, Clone, SmartDefault, Doku)] #[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
#[serde(default)] #[serde(default)]
pub struct RateLimitConfig { pub struct RateLimitConfig {
#[default(180)] #[default(180)]
@ -107,7 +107,7 @@ pub struct RateLimitConfig {
pub image_per_second: i32, pub image_per_second: i32,
} }
#[derive(Debug, Deserialize, Clone, SmartDefault, Doku)] #[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
pub struct SetupConfig { pub struct SetupConfig {
#[doku(example = "admin")] #[doku(example = "admin")]
pub admin_username: String, pub admin_username: String,

View File

@ -7,6 +7,7 @@ use diesel::{
r2d2::{ConnectionManager, Pool}, r2d2::{ConnectionManager, Pool},
PgConnection, PgConnection,
}; };
use doku::json::{AutoComments, Formatting};
use lemmy_api::match_websocket_operation; use lemmy_api::match_websocket_operation;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_api_crud::match_websocket_operation_crud; use lemmy_api_crud::match_websocket_operation_crud;
@ -32,7 +33,11 @@ embed_migrations!();
async fn main() -> Result<(), LemmyError> { async fn main() -> Result<(), LemmyError> {
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
if args.len() == 2 && args[1] == "--print-config-docs" { if args.len() == 2 && args[1] == "--print-config-docs" {
println!("{}", doku::to_json_val(&Settings::default())); let fmt = Formatting {
auto_comments: AutoComments::none(),
..Default::default()
};
println!("{}", doku::to_json_fmt_val(&fmt, &Settings::default()));
return Ok(()); return Ok(());
} }