File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,21 @@ export let config = {
7676 * Default TTL (time to live) for cache entries in seconds
7777 */
7878 defaultTtl : Env . getNumber ( 'CACHE_DEFAULT_TTL_SECONDS' , 3600 ) * 1000
79+ } ,
80+
81+ server : {
82+ /**
83+ * Skip healthz endpoint even if health checks are configured
84+ * Default: false
85+ * Set to true to return 200 OK for /healthz without checks
86+ * Useful in environments where a simple liveness probe is needed
87+ * without performing actual health checks
88+ * Example: Kubernetes liveness probe
89+ * Note: This does not disable the health check functionality itself
90+ * Health checks can still be performed programmatically
91+ * or via other endpoints if needed
92+ */
93+ skipHealthz : Env . getBoolean ( 'SERVER_SKIP_HEALTHZ' , false )
7994 }
8095} ;
8196
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import { getLogger } from '../utils/logger.utils';
3333import { InternalServerErrorException , ServiceUnavailableException } from '../utils/exception.utils' ;
3434import { NotFoundException } from '../utils/exception.utils' ;
3535import fs from 'fs' ;
36- import { defaultServerConfig } from '../config' ;
36+ import { config , defaultServerConfig } from '../config' ;
3737import { deepObjMerge } from '../utils/obj.utils' ;
3838import { fileExists } from '../utils/fs.utils' ;
3939import { Socket } from 'net' ;
@@ -575,7 +575,7 @@ export class ExpressServer {
575575
576576 this . app . get ( healthCheckPath , async ( _req : Request , res : Response ) => {
577577 try {
578- if ( ! this . healthChecks . length ) {
578+ if ( ! this . healthChecks . length || config . server . skipHealthz ) {
579579 return res . status ( HttpStatusCodes . OK ) . json ( new SuccessResponse ( 'OK' ) ) ;
580580 }
581581
Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ describe('config', () => {
105105 } ,
106106 cache : {
107107 defaultTtl : 3600000
108+ } ,
109+ server : {
110+ skipHealthz : false
108111 }
109112 } ) ;
110113 } ) ;
You can’t perform that action at this time.
0 commit comments