29 lines
786 B
TypeScript
29 lines
786 B
TypeScript
import { NextResponse } from 'next/server'
|
|
import { getRuntimeEnv } from '@/lib/ipconfig' // 路径按你项目实际调整
|
|
|
|
export const runtime = 'nodejs'
|
|
|
|
export async function GET() {
|
|
let ip: string | null = null
|
|
let res: string | undefined = undefined
|
|
|
|
try {
|
|
res = await getRuntimeEnv('SUPABASE_URL')
|
|
ip = res ?? null
|
|
|
|
console.log('[health-check] getRuntimeEnv("SUPABASE_URL") 返回:', res)
|
|
console.log('[health-check] ip 赋值结果:', ip)
|
|
} catch (e: any) {
|
|
ip = null
|
|
console.error('[health-check] 捕获异常:', e)
|
|
}
|
|
|
|
// 额外打印进程环境变量(一次就行,便于调试)
|
|
console.log('[health-check] process.env.SUPABASE_URL =', process.env.SUPABASE_URL)
|
|
|
|
return NextResponse.json({
|
|
status: 'ok',
|
|
ip,
|
|
})
|
|
}
|