From ae4f102bdf4143ef2200d5fe2e907eab36df8670 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Sat, 17 Apr 2021 19:26:05 -0500 Subject: [PATCH] :recycle: refactor: make git_version module private --- Cargo.lock | 2 +- crates/ptth_relay/Cargo.toml | 4 ++-- crates/ptth_relay/src/lib.rs | 14 +++++++++++++- crates/ptth_relay/src/main.rs | 9 --------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc26eaf..a0e9fec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1529,7 +1529,7 @@ dependencies = [ [[package]] name = "ptth_relay" -version = "1.2.0" +version = "1.3.0" dependencies = [ "base64", "blake3", diff --git a/crates/ptth_relay/Cargo.toml b/crates/ptth_relay/Cargo.toml index c3f0364..0290303 100644 --- a/crates/ptth_relay/Cargo.toml +++ b/crates/ptth_relay/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ptth_relay" -version = "1.2.0" +version = "2.0.0" authors = ["Trish"] edition = "2018" license = "AGPL-3.0" @@ -35,4 +35,4 @@ tracing = "0.1.25" tracing-futures = "0.2.4" tracing-subscriber = "0.2.15" -ptth_core = { path = "../ptth_core", version = "1.3.0" } +ptth_core = { path = "../ptth_core", version = "1.4.0" } diff --git a/crates/ptth_relay/src/lib.rs b/crates/ptth_relay/src/lib.rs index 1e46516..44d52b3 100644 --- a/crates/ptth_relay/src/lib.rs +++ b/crates/ptth_relay/src/lib.rs @@ -1,3 +1,8 @@ +//! # PTTH Relay +//! +//! ptth_relay runs on a public-facing web server and accepts +//! incoming HTTP connections from both HTTP clients and PTTH servers. + #![warn (clippy::pedantic)] // I don't see the point of writing the type twice if I'm initializing a struct @@ -57,9 +62,9 @@ use ptth_core::{ pub mod config; pub mod errors; -pub mod git_version; pub mod key_validity; +mod git_version; mod relay_state; mod routing; mod scraper_api; @@ -612,6 +617,13 @@ pub async fn run_relay ( AuditEvent, }; + if let Some (x) = git_version::read ().await { + info! ("ptth_relay Git version: {:?}", x); + } + else { + info! ("ptth_relay not built from Git"); + } + if let Some (config_reload_path) = config_reload_path { let state_2 = state.clone (); tokio::spawn (async move { diff --git a/crates/ptth_relay/src/main.rs b/crates/ptth_relay/src/main.rs index 428624e..394e0d5 100644 --- a/crates/ptth_relay/src/main.rs +++ b/crates/ptth_relay/src/main.rs @@ -8,7 +8,6 @@ use std::{ }; use clap::{App, SubCommand}; -use tracing::{info}; use tracing_subscriber::{ fmt, fmt::format::FmtSpan, @@ -17,7 +16,6 @@ use tracing_subscriber::{ use ptth_relay::{ Config, - git_version, RelayState, run_relay, }; @@ -52,13 +50,6 @@ async fn main () -> Result <(), Box > { let config_path = PathBuf::from ("config/ptth_relay.toml"); let config = Config::from_file (&config_path).await?; - if let Some (x) = git_version::read ().await { - info! ("ptth_relay Git version: {:?}", x); - } - else { - info! ("ptth_relay not built from Git"); - } - let (shutdown_rx, forced_shutdown) = ptth_core::graceful_shutdown::init_with_force (); forced_shutdown.wrap_server (