From 83d2959b4b09a5613e450191f65a4a37c1c3c4d8 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 11 Nov 2022 21:01:29 +0000 Subject: [PATCH] Update doku dependency for easier formatting of defaults.hjson (#2553) --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- config/defaults.hjson | 2 +- crates/utils/Cargo.toml | 2 +- scripts/update_config_defaults.sh | 7 ------- src/main.rs | 9 ++++++++- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1d6f2940e..bf77294ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1219,9 +1219,9 @@ dependencies = [ [[package]] name = "doku" -version = "0.12.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e0b8876b34b3a2504166bac1a5a8cb7ad65dc854e7a70b1114c055df1efc04" +checksum = "966b1227ac4d9d77f4d7e9507dd01c56ceaec6e35888661b54319123da47b159" dependencies = [ "doku-derive", "serde", @@ -1231,9 +1231,9 @@ dependencies = [ [[package]] name = "doku-derive" -version = "0.12.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6430bef5fcbfa22f3c431f05a14254d45f41ab634cabe09fad82e98d4f9fdc8b" +checksum = "252ec56116f931b050b5d80512c2c76f4807a297dd95a93f37593dd7650868a5" dependencies = [ "darling 0.13.4", "proc-macro2 1.0.47", diff --git a/Cargo.toml b/Cargo.toml index c01d013c9..30d36e948 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ reqwest = { version = "0.11.12", features = ["json"] } reqwest-middleware = "0.1.6" reqwest-tracing = "0.3.1" clokwerk = "0.3.5" -doku = { version = "0.12.0", features = ["url-2"] } +doku = { version = "0.20.0", features = ["url-2"] } parking_lot = "0.12.1" reqwest-retry = "0.1.5" console-subscriber = { version = "0.1.8", optional = true } diff --git a/config/defaults.hjson b/config/defaults.hjson index e92117787..e2ad2b41a 100644 --- a/config/defaults.hjson +++ b/config/defaults.hjson @@ -30,7 +30,7 @@ smtp_login: "string" # Password to login to the smtp server smtp_password: "string" - # Address to send emails from, eg noreply@your-instance.com + # Address to send emails from, eg "noreply@your-instance.com" smtp_from_address: "noreply@example.com" # Whether or not smtp connections should use tls. Can be none, tls, or starttls tls_type: "none" diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index f4537590e..43cbd8bff 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -38,7 +38,7 @@ http = "0.2.8" deser-hjson = "1.0.2" smart-default = "0.6.0" jsonwebtoken = "8.1.1" -doku = { version = "0.12.0", features = ["url-2"] } +doku = { version = "0.20.0", features = ["url-2"] } uuid = { version = "1.2.1", features = ["serde", "v4"] } html2text = "0.4.3" rosetta-i18n = "0.1.2" diff --git a/scripts/update_config_defaults.sh b/scripts/update_config_defaults.sh index f15f54a30..07aceb3ef 100755 --- a/scripts/update_config_defaults.sh +++ b/scripts/update_config_defaults.sh @@ -4,10 +4,3 @@ set -e dest=${1-config/defaults.hjson} cargo run -- --print-config-docs > "$dest" -# replace // comments with # -sed -i "s/^\([[:space:]]*\)\/\//\1#/" "$dest" -# remove trailing commas -sed -i "s/,\$//" "$dest" -# remove quotes around json keys -sed -i "s/\"//" "$dest" -sed -i "s/\"//" "$dest" diff --git a/src/main.rs b/src/main.rs index fd0f3c703..5d1a3a1a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ extern crate diesel_migrations; use actix::prelude::*; use actix_web::{web::Data, *}; use diesel_migrations::EmbeddedMigrations; -use doku::json::{AutoComments, Formatting}; +use doku::json::{AutoComments, CommentsStyle, Formatting, ObjectsStyle}; use lemmy_api::match_websocket_operation; use lemmy_api_common::{ lemmy_db_views::structs::SiteView, @@ -56,6 +56,13 @@ async fn main() -> Result<(), LemmyError> { if args.len() == 2 && args[1] == "--print-config-docs" { let fmt = Formatting { auto_comments: AutoComments::none(), + comments_style: CommentsStyle { + separator: "#".to_owned(), + }, + objects_style: ObjectsStyle { + surround_keys_with_quotes: false, + use_comma_as_separator: false, + }, ..Default::default() }; println!("{}", doku::to_json_fmt_val(&fmt, &Settings::default()));