Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust the config check to be a separate faster to compile binary #3313

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/utils/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use doku::json::{AutoComments, CommentsStyle, Formatting, ObjectsStyle};
use lemmy_utils::settings::structs::Settings;
fn main() {
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()));
}
2 changes: 1 addition & 1 deletion scripts/update_config_defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e

dest=${1-config/defaults.hjson}

cargo run -- --print-config-docs > "$dest"
cargo run --manifest-path crates/utils/Cargo.toml > "$dest"
22 changes: 1 addition & 21 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{code_migrations::run_advanced_migrations, root_span_builder::Quieter
use activitypub_federation::config::{FederationConfig, FederationMiddleware};
use actix_cors::Cors;
use actix_web::{middleware, web::Data, App, HttpServer, Result};
use doku::json::{AutoComments, CommentsStyle, Formatting, ObjectsStyle};
use lemmy_api_common::{
context::LemmyContext,
lemmy_db_views::structs::SiteView,
Expand All @@ -25,11 +24,7 @@ use lemmy_db_schema::{
utils::{build_db_pool, get_database_url, run_migrations},
};
use lemmy_routes::{feeds, images, nodeinfo, webfinger};
use lemmy_utils::{
error::LemmyError,
rate_limit::RateLimitCell,
settings::{structs::Settings, SETTINGS},
};
use lemmy_utils::{error::LemmyError, rate_limit::RateLimitCell, settings::SETTINGS};
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use reqwest_tracing::TracingMiddleware;
Expand All @@ -47,21 +42,6 @@ pub(crate) const REQWEST_TIMEOUT: Duration = Duration::from_secs(10);
/// Placing the main function in lib.rs allows other crates to import it and embed Lemmy
pub async fn start_lemmy_server() -> Result<(), LemmyError> {
let args: Vec<String> = env::args().collect();
if args.get(1) == Some(&"--print-config-docs".to_string()) {
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()));
return Ok(());
}

let scheduled_tasks_enabled = args.get(1) != Some(&"--disable-scheduled-tasks".to_string());

Expand Down