Skip to content

Commit 0c9db92

Browse files
authored
Merge pull request #12 from cantsdmr/feature/config-file-changable-name
custom config file support
2 parents 1416ca3 + f877e47 commit 0c9db92

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ program
2323
.option('-c, --capture', 'Enable capture mode')
2424
.option('-v, --verbose', 'Enable verbose mode')
2525
.option('-d, --disable-mocks', 'Temporary disable mocks to just use proxy')
26+
.option('-i, --config-path <config-path>', 'Custom config file path', 'mock.config.js')
2627
.parse(process.argv);
2728

2829
function escapeRegExp(str) {
@@ -44,8 +45,10 @@ var defaultConfig = {
4445
var config = defaultConfig;
4546

4647
try {
47-
var loadedConfig = require(path.resolve(process.cwd(), 'mock.config.js'));
48-
console.log('Config file found mocking!');
48+
var configFilePath = path.resolve(process.cwd(), program.configPath);
49+
var loadedConfig = require(configFilePath);
50+
51+
console.log(`Config file found mocking! : ${configFilePath}`);
4952

5053
config.map = {};
5154

0 commit comments

Comments
 (0)