diff --git a/server/src/lib/constants/version.ts b/server/src/lib/constants/version.ts index 3b464ab88..7bc3b277c 100644 --- a/server/src/lib/constants/version.ts +++ b/server/src/lib/constants/version.ts @@ -6,6 +6,7 @@ import semver from "semver"; import { execSync } from "child_process"; import fs from "fs"; import path from "path"; +import { Environment } from "lib/setup/config"; // As is with all front-facing zkldi projects, the version names for tachi-server // are from an album I like. In this case, the al(bum is Portishead - Dummy. @@ -65,9 +66,15 @@ if (!semverInfo) { let commit: string | null = null; try { - // This fetches the HEAD of our current running branch. This is useful for debugging. - // Note that git returns this with a trailing newline, so we have to trim that off. - commit = execSync("git rev-parse --short HEAD").toString("utf-8").trim(); + if (Environment.commitHash) { + commit = Environment.commitHash; + } else { + // This fetches the HEAD of our current running branch. This is useful for debugging. + // Note that git returns this with a trailing newline, so we have to trim that off. + commit = execSync("git rev-parse --short HEAD").toString("utf-8").trim(); + } + + } catch (err) { logger.warn(`Failed to read what commit we're on -- Using null as our commit version.`, { err, diff --git a/server/src/lib/setup/config.ts b/server/src/lib/setup/config.ts index 99a571bd7..459a4bfc1 100644 --- a/server/src/lib/setup/config.ts +++ b/server/src/lib/setup/config.ts @@ -300,4 +300,5 @@ export const Environment = { nodeEnv, replicaIdentity, seqUrl, + commitHash: process.env.COMMIT_HASH };