Use GIT_HASH for network identifier

This commit is contained in:
Sofia 2026-08-08 00:01:34 +03:00
parent 64d8c148ce
commit d3c6602901
2 changed files with 12 additions and 1 deletions

11
rust/build.rs Normal file
View File

@ -0,0 +1,11 @@
use std::process::Command;
// https://stackoverflow.com/a/44407625
fn main() {
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.output()
.unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
}

View File

@ -323,7 +323,7 @@ impl NetworkManager {
} }
fn identifier() -> String { fn identifier() -> String {
format!("{}@{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")) format!("{}@{}", env!("CARGO_PKG_NAME"), env!("GIT_HASH"))
} }
} }