test
This commit is contained in:
@@ -31,6 +31,28 @@ export async function getGitCommitInfo(): Promise<GitInfo> {
|
||||
return gitInfo;
|
||||
}
|
||||
|
||||
// In Docker, the hash might be stored in a file at /app/git_commit_sha
|
||||
if (typeof window === 'undefined') {
|
||||
try {
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Check for Docker-specific git hash file
|
||||
const dockerGitHashPath = '/app/git_commit_sha';
|
||||
if (fs.existsSync(dockerGitHashPath)) {
|
||||
const hash = fs.readFileSync(dockerGitHashPath, 'utf8').trim();
|
||||
const gitInfo: GitInfo = {
|
||||
commitHash: hash,
|
||||
buildTime: new Date().toISOString(),
|
||||
};
|
||||
cachedGitInfo = gitInfo;
|
||||
return gitInfo;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Could not read git hash from Docker file', error);
|
||||
}
|
||||
}
|
||||
|
||||
// In the browser, fetch from the public directory
|
||||
if (typeof window !== 'undefined') {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user