Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 9ee9195

Browse files
committed
Include git hash in startup line
1 parent 846e7b3 commit 9ee9195

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
use std::process::Command;
2+
13
fn main() {
24
println!("cargo:rerun-if-changed=migrations");
35
println!("cargo:rerun-if-changed=.sqlx-check.db");
6+
7+
let output = Command::new("git").args(&["rev-parse", "HEAD"]).output().unwrap();
8+
let git_hash = String::from_utf8(output.stdout).unwrap();
9+
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
410
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async fn main() -> anyhow::Result<()> {
8787

8888
env_logger::init_from_env(Env::default().default_filter_or("info"));
8989

90-
info!("AxolotlClient-Api v{}", env!("CARGO_PKG_VERSION"));
90+
info!("AxolotlClient-Api v{} ({})", env!("CARGO_PKG_VERSION"), env!("GIT_HASH"));
9191

9292
let database = {
9393
let postgres_url = match &cl_args.postgres.postgres_url {

0 commit comments

Comments
 (0)