♻️ refactor: make git_version module private

main
_ 2021-04-17 19:26:05 -05:00
parent fd238d8c2b
commit ae4f102bdf
4 changed files with 16 additions and 13 deletions

2
Cargo.lock generated
View File

@ -1529,7 +1529,7 @@ dependencies = [
[[package]] [[package]]
name = "ptth_relay" name = "ptth_relay"
version = "1.2.0" version = "1.3.0"
dependencies = [ dependencies = [
"base64", "base64",
"blake3", "blake3",

View File

@ -1,7 +1,7 @@
[package] [package]
name = "ptth_relay" name = "ptth_relay"
version = "1.2.0" version = "2.0.0"
authors = ["Trish"] authors = ["Trish"]
edition = "2018" edition = "2018"
license = "AGPL-3.0" license = "AGPL-3.0"
@ -35,4 +35,4 @@ tracing = "0.1.25"
tracing-futures = "0.2.4" tracing-futures = "0.2.4"
tracing-subscriber = "0.2.15" tracing-subscriber = "0.2.15"
ptth_core = { path = "../ptth_core", version = "1.3.0" } ptth_core = { path = "../ptth_core", version = "1.4.0" }

View File

@ -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)] #![warn (clippy::pedantic)]
// I don't see the point of writing the type twice if I'm initializing a struct // 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 config;
pub mod errors; pub mod errors;
pub mod git_version;
pub mod key_validity; pub mod key_validity;
mod git_version;
mod relay_state; mod relay_state;
mod routing; mod routing;
mod scraper_api; mod scraper_api;
@ -612,6 +617,13 @@ pub async fn run_relay (
AuditEvent, 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 { if let Some (config_reload_path) = config_reload_path {
let state_2 = state.clone (); let state_2 = state.clone ();
tokio::spawn (async move { tokio::spawn (async move {

View File

@ -8,7 +8,6 @@ use std::{
}; };
use clap::{App, SubCommand}; use clap::{App, SubCommand};
use tracing::{info};
use tracing_subscriber::{ use tracing_subscriber::{
fmt, fmt,
fmt::format::FmtSpan, fmt::format::FmtSpan,
@ -17,7 +16,6 @@ use tracing_subscriber::{
use ptth_relay::{ use ptth_relay::{
Config, Config,
git_version,
RelayState, RelayState,
run_relay, run_relay,
}; };
@ -52,13 +50,6 @@ async fn main () -> Result <(), Box <dyn Error>> {
let config_path = PathBuf::from ("config/ptth_relay.toml"); let config_path = PathBuf::from ("config/ptth_relay.toml");
let config = Config::from_file (&config_path).await?; 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 (); let (shutdown_rx, forced_shutdown) = ptth_core::graceful_shutdown::init_with_force ();
forced_shutdown.wrap_server ( forced_shutdown.wrap_server (