-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Advice: add mocker api config like mocker.config.js
#144
Comments
@vanpipy I don't know what you are going to do. |
Because the implementation is:
Like this - mocker mock/index.js
+ mocker --config mocker.config.json mock/index.js // or
+ mocker mock/inde.js // search the mocker.config.json in the project defaulty
And the user can set the Is that necessary? |
@vanpipy Support |
@vanpipy Upgrade |
Hi, @jaywcjlove , I got your idea, the next PR will upgrade the version and the document together. |
@vanpipy Support setting configuration on package.json? {
...
"mocker": {
"host": "127.0.0.1",
"port": 7788
}
} |
That is a better choice :D. And a result needs to figure out which one is the first config for the user. I suggest the priority:
|
@vanpipy Support setting parameters: mocker mock/index.js --port 7788
mocker mock/index.js --host 0.0.0.0 help: Usage: mocker <path> [--config] [--help|h]
Displays help information.
Options:
--config <path> Simple configuration
Example:
mocker mock/index.js
mocker mock/index.js --port 7788
mocker mock/index.js --host 0.0.0.0
mocker mock/m1.js test/m2.js
mocker mock/m1.js --config mocker.config.json |
Hi, @jaywcjlove , Yes, |
Hi @vanpipy I hope to help improve the documentation when I have time, thank you! Command line supports more parameter configuration: {
...
"mocker": {
"host": "127.0.0.1",
"port": 7788,
"pathRewrite": {
"^/api/repos/": "/repos/"
},
"changeHost": true,
...
}
} |
Summary: The mocker command line support 3 parameters:
Of course, the And the priority of the config - assuming three configurations exist already.
First, the mocker commander will try to find the That is all things of the mocker command line doing. |
@vanpipy thx! Released |
The issue resolved, so close it. |
Hi, I used the independent mode like
mocker mock/index.js
and found that the host and port cannot change in this mode. So I feel it's not easy to use as a part of a project. Try to get theHOST
andPORT
from a config file will be better than using theprocess.env
.Is this useful or need that?
Thanks.
The text was updated successfully, but these errors were encountered: