Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(mock): check process.env.MIDWAY_HTTP_PORT #3599

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/mock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ const { join } = require('path');
...args,
});

const port = process.env.MIDWAY_HTTP_PORT
if (! port) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不一定有,比如纯 grpc 服务就没有 http port 了

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那要不要改成输出一个日志提示没有值

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也有点诡异,目的是为了解决启动卡住的问题吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,挺奇怪的,相同的配置参数 ( run dev ) , 命令行启动正常。而在 vscode 的 F5 启动就卡住,排查下来就是没有配置端口导致的。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw new Error('MIDWAY_HTTP_PORT is not defined');
}

process.send({
title: 'server-ready',
port: process.env.MIDWAY_HTTP_PORT,
port,
ssl: args.ssl,
});

Expand Down