From 1ed74fc8175ae40dcfcb4753c6fba3167bc9292f Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Thu, 8 Jan 2026 13:08:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E9=85=8D=E7=BD=AE=E6=9C=8D=E5=8A=A1=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从环境变量中获取HOST或BIND_ADDR配置服务监听地址,未配置时默认使用'0.0.0.0' --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index bcbf7ce..df22de5 100644 --- a/index.js +++ b/index.js @@ -607,7 +607,8 @@ fastify.get('/*', async (request, reply) => { }); // Run -fastify.listen({ port: PORT, host: '0.0.0.0' }, (err, address) => { +const HOST = process.env.HOST || process.env.BIND_ADDR || '0.0.0.0'; +fastify.listen({ port: PORT, host: HOST }, (err, address) => { if (err) { console.error(err); process.exit(1);