fix: 使用环境变量配置服务监听地址

从环境变量中获取HOST或BIND_ADDR配置服务监听地址,未配置时默认使用'0.0.0.0'
This commit is contained in:
2026-01-08 13:08:41 +08:00
parent e50df0eaf6
commit 1ed74fc817

View File

@@ -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);