aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-07 11:59:56 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-07 11:59:56 +0200
commitdb61f41030678c5756c844c8aa41a210c658769e (patch)
tree492bff626d37cbcdfb2a65ee2580a1cc60c13125 /src/model
parent6f02c36a89d93b04944a3f0882b6f6b703d9c012 (diff)
downloadgarage-db61f41030678c5756c844c8aa41a210c658769e.tar.gz
garage-db61f41030678c5756c844c8aa41a210c658769e.zip
Move GIT_VERSION injection later in build chain to reduce build times
Diffstat (limited to 'src/model')
-rw-r--r--src/model/Cargo.toml1
-rw-r--r--src/model/lib.rs1
-rw-r--r--src/model/version.rs7
3 files changed, 9 insertions, 0 deletions
diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml
index bbcfe89c..c41d3f16 100644
--- a/src/model/Cargo.toml
+++ b/src/model/Cargo.toml
@@ -24,6 +24,7 @@ async-trait = "0.1.7"
arc-swap = "1.0"
blake2 = "0.9"
err-derive = "0.3"
+git-version = "0.3.4"
hex = "0.4"
base64 = "0.13"
tracing = "0.1.30"
diff --git a/src/model/lib.rs b/src/model/lib.rs
index 4f20ea46..43db01c5 100644
--- a/src/model/lib.rs
+++ b/src/model/lib.rs
@@ -19,3 +19,4 @@ pub mod s3;
pub mod garage;
pub mod helper;
pub mod migrate;
+pub mod version;
diff --git a/src/model/version.rs b/src/model/version.rs
new file mode 100644
index 00000000..cdb3ea62
--- /dev/null
+++ b/src/model/version.rs
@@ -0,0 +1,7 @@
+pub fn garage_version() -> &'static str {
+ option_env!("GIT_VERSION").unwrap_or(git_version::git_version!(
+ prefix = "git:",
+ cargo_prefix = "cargo:",
+ fallback = "unknown"
+ ))
+}