Skip to content

Commit

Permalink
feat: The mocker command add port/host parameters. #144
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 27, 2020
1 parent fa1e369 commit 0f3b426
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/core/src/bin/mocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface MockerConfig {
console.log(' --config <path>', 'Simple configuration')
console.log('\n Example:')
console.log(' mocker mock/index.js')
console.log(' mocker mock/index.js --port 7788')
console.log(' mocker mock/index.js --host 0.0.0.0')
console.log(' mocker mock/m1.js test/m2.js')
console.log(' mocker mock/m1.js --config mocker.config.json')
return;
Expand Down Expand Up @@ -57,6 +59,14 @@ interface MockerConfig {
mockerConfig = require(path.resolve(mockConfigPath));
}

if (argvs.port) {
mockerConfig.port = argvs.port;
}

if (argvs.host) {
mockerConfig.host = argvs.host;
}

const DEFAULT_PORT = mockerConfig.port;
const app = express();

Expand Down

0 comments on commit 0f3b426

Please sign in to comment.