From 8e0addc3e09cf8cd2e49b8bbcd7206312ac76ee2 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sun, 29 Jan 2023 14:22:57 +0000 Subject: [PATCH] fix: fallback properly if no VERGEN strings can generate --- crates/delta/src/routes/root.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/crates/delta/src/routes/root.rs b/crates/delta/src/routes/root.rs index 59bd8dc9..c6743142 100644 --- a/crates/delta/src/routes/root.rs +++ b/crates/delta/src/routes/root.rs @@ -119,12 +119,21 @@ pub async fn root() -> Result> { app: APP_URL.to_string(), vapid: VAPID_PUBLIC_KEY.to_string(), build: BuildInformation { - commit_sha: env!("VERGEN_GIT_SHA", "").to_string(), - commit_timestamp: env!("VERGEN_GIT_COMMIT_TIMESTAMP", "") + commit_sha: option_env!("VERGEN_GIT_SHA") + .unwrap_or_else(|| "") + .to_string(), + commit_timestamp: option_env!("VERGEN_GIT_COMMIT_TIMESTAMP") + .unwrap_or_else(|| "") + .to_string(), + semver: option_env!("VERGEN_GIT_SEMVER") + .unwrap_or_else(|| "") + .to_string(), + origin_url: option_env!("GIT_ORIGIN_URL") + .unwrap_or_else(|| "") + .to_string(), + timestamp: option_env!("VERGEN_BUILD_TIMESTAMP") + .unwrap_or_else(|| "") .to_string(), - semver: env!("VERGEN_GIT_SEMVER", "").to_string(), - origin_url: env!("GIT_ORIGIN_URL", "").to_string(), - timestamp: env!("VERGEN_BUILD_TIMESTAMP", "").to_string(), }, })) }