Skip to content

Commit

Permalink
chore: display git hash
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Feb 5, 2024
1 parent 8ff4b1d commit 5292230
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions components/ordhook-cli/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use std::process::Command;

fn main() {
// note: add error checking yourself.
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);
}
4 changes: 2 additions & 2 deletions components/ordhook-cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,8 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
}

let ordhook_config = config.get_ordhook_config();

info!(ctx.expect_logger(), "Starting service...",);
let version = env!("GIT_HASH");
info!(ctx.expect_logger(), "Starting service (git_hash = {})...", version);

let start_block = match cmd.start_at_block {
Some(entry) => entry,
Expand Down

0 comments on commit 5292230

Please sign in to comment.