mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-29 02:18:09 +03:00
feat: enable storing commitHash in env var
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -300,4 +300,5 @@ export const Environment = {
|
||||
nodeEnv,
|
||||
replicaIdentity,
|
||||
seqUrl,
|
||||
commitHash: process.env.COMMIT_HASH
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user