From 1a9fb8c69e0b87b6065aba580b1a71e0fd35ba9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Tr=C4=85d?= Date: Tue, 23 Apr 2024 00:57:05 +0200 Subject: [PATCH] Dzejkop/add-initial-log (#712) --- Cargo.toml | 1 + Dockerfile | 2 +- build.rs | 12 ++++++++++++ src/main.rs | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index ab9f0336..2e9f7cd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ keywords = ["worldcoin", "protocol", "signup"] categories = ["cryptography::cryptocurrencies"] readme = "Readme.md" license-file = "LICENSE.md" +build = "build.rs" [workspace] members = ["crates/*"] diff --git a/Dockerfile b/Dockerfile index 451d020d..227b2f68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY . . # Install dependencies RUN apt-get update && \ - apt-get install -y curl build-essential libssl-dev texinfo libcap2-bin pkg-config + apt-get install -y git curl build-essential libssl-dev texinfo libcap2-bin pkg-config # TODO: Use a specific version of rustup # Install rustup diff --git a/build.rs b/build.rs new file mode 100644 index 00000000..08dfe684 --- /dev/null +++ b/build.rs @@ -0,0 +1,12 @@ +use std::process::Command; + +fn main() { + let output = Command::new("git") + .args(["describe", "--tags", "--always"]) + .output() + .expect("Failed to execute git command"); + + let git_description = String::from_utf8_lossy(&output.stdout).trim().to_string(); + + println!("cargo:rustc-env=GIT_VERSION={}", git_description); +} diff --git a/src/main.rs b/src/main.rs index f0fa20e3..840bc3bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,6 +39,10 @@ async fn sequencer_app(args: Args) -> anyhow::Result<()> { watch_shutdown_signals(); + let version = env!("GIT_VERSION"); + + tracing::info!(?config, version, "Starting the app"); + let server_config = config.server.clone(); // Create App struct