aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
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"
+ ))
+}