22 lines
548 B
TypeScript
22 lines
548 B
TypeScript
import gitInfo from "../public/git-info.json";
|
|
|
|
/**
|
|
* Git utility to load commit hash in both development and production environments
|
|
*/
|
|
|
|
interface GitInfo {
|
|
commitHash: string;
|
|
buildTime: string;
|
|
}
|
|
|
|
let cachedGitInfo: GitInfo | null = null;
|
|
|
|
/**
|
|
* Gets the current git commit hash from various sources
|
|
* - First tries environment variable (from Docker)
|
|
* - Then tries the JSON file created by our build script
|
|
* - Returns "dev" if nothing is available
|
|
*/
|
|
export async function getGitCommitInfo(): Promise<GitInfo> {
|
|
return gitInfo;
|
|
}
|