refactor remove upstream env dependency (#551)
This commit is contained in:
@@ -2,7 +2,6 @@ import { existsSync, readFileSync } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
import * as hermesCli from '../services/hermes/hermes-cli'
|
||||
import { getGatewayManagerInstance } from '../services/gateway-bootstrap'
|
||||
import { config } from '../config'
|
||||
|
||||
declare const __APP_VERSION__: string
|
||||
|
||||
@@ -73,7 +72,10 @@ export async function healthCheck(ctx: any) {
|
||||
let gatewayOk = false
|
||||
try {
|
||||
const mgr = getGatewayManagerInstance()
|
||||
const upstream = mgr?.getUpstream() || config.upstream
|
||||
const upstream = mgr?.getUpstream()
|
||||
if (!upstream) {
|
||||
throw new Error('GatewayManager not initialized')
|
||||
}
|
||||
const res = await fetch(`${upstream.replace(/\/$/, '')}/health`, { signal: AbortSignal.timeout(5000) })
|
||||
gatewayOk = res.ok
|
||||
} catch { }
|
||||
|
||||
Reference in New Issue
Block a user