File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 1+ const { execSync } = require ( 'child_process' ) ;
2+
13const HealthCheckController = { } ;
24
5+ function getBuildInfo ( ) {
6+ try {
7+ // Try to get git info from the container
8+ const gitSha = execSync ( 'git rev-parse --short HEAD 2>/dev/null || echo "unknown"' , {
9+ encoding : 'utf8' ,
10+ } ) . trim ( ) ;
11+ return gitSha ;
12+ } catch {
13+ return process . env . BUILD_SHA || 'unknown' ;
14+ }
15+ }
16+
317HealthCheckController . isAlive = ( _ , res ) => {
4- res
5- . status ( 200 )
6- . send ( `I'm Alive! Build: ${ process . env . BUILD_SHA || 'unknown' } - ${ new Date ( ) . toISOString ( ) } ` ) ;
18+ const buildInfo = getBuildInfo ( ) ;
19+ res . status ( 200 ) . send ( `I'm Alive! Build: ${ buildInfo } - ${ new Date ( ) . toISOString ( ) } ` ) ;
720} ;
821
922module . exports = HealthCheckController ;
You can’t perform that action at this time.
0 commit comments