feat: added git info to startup version string

This commit is contained in:
antifallobst 2024-03-17 21:33:54 +01:00
parent f79b9992bc
commit a6b022e70b
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
3 changed files with 20 additions and 1 deletions

12
Cargo.lock generated
View File

@ -423,6 +423,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"anyhow", "anyhow",
"compile-time-run",
"dotenv", "dotenv",
"env_logger", "env_logger",
"log", "log",
@ -435,6 +436,17 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "compile-time-run"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b5affba7c91c039a483065125dd8c6d4a0985e1e9ac5ab6dffdea4fe4e637f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "const-oid" name = "const-oid"
version = "0.9.6" version = "0.9.6"

View File

@ -12,6 +12,7 @@ anyhow = "1.0.81"
log = "0.4.21" log = "0.4.21"
env_logger = "0.11.3" env_logger = "0.11.3"
dotenv = "0.15.0" dotenv = "0.15.0"
compile-time-run = "0.2.12"
actix-web = "4.5.1" actix-web = "4.5.1"
sqlx = { version = "0.7.4", features = ["runtime-tokio", "tls-native-tls"] } sqlx = { version = "0.7.4", features = ["runtime-tokio", "tls-native-tls"] }

View File

@ -1,6 +1,7 @@
mod config; mod config;
use anyhow::Result; use anyhow::Result;
use compile_time_run::run_command_str;
use config::Config; use config::Config;
use log::info; use log::info;
@ -9,7 +10,12 @@ async fn main() -> Result<()> {
dotenv::dotenv()?; dotenv::dotenv()?;
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
info!("Starting Cipher Relay (v{} - )", env!("CARGO_PKG_VERSION")); info!(
"Starting Cipher Relay (v{} - git: {}/{})",
env!("CARGO_PKG_VERSION"),
run_command_str!("git", "branch", "--show-current"),
run_command_str!("git", "describe", "--always", "--dirty=-modified")
);
let config = Config::from_env()?; let config = Config::from_env()?;