Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
akupiec
GitHub Repository: akupiec/mad-proxy
Path: blob/master/src/config/argv.js
115 views
1
/* globals process */
2
const yargs = require('yargs');
3
4
const GENERAL_GROUP = 'General:';
5
const SERVER_GROUP = 'Local Server:';
6
const PROXY_GROUP = 'Proxy Server:';
7
const argv = yargs.usage('$0 cli usage:')
8
.option('config', {
9
alias: 'c',
10
describe: 'Path to the config file, accepts js|json. All cli options can be override by configuration file.',
11
type: 'string',
12
group: GENERAL_GROUP,
13
// default: 'mad-proxy.json',
14
})
15
.options('mock', {
16
alias: 'm',
17
describe: 'destination path where mocks will be stored',
18
group: GENERAL_GROUP,
19
})
20
.options('server.port', {
21
alias: ['port'],
22
type: 'number',
23
describe: 'local server port',
24
group: SERVER_GROUP,
25
})
26
.options('server.fallback', {
27
type: 'string',
28
describe: 'File served by default when nothing else fits ex. local index.html',
29
group: SERVER_GROUP,
30
})
31
.options('proxy.target', {
32
alias: ['target'],
33
type: 'string',
34
describe: 'proxy destination serer url',
35
group: PROXY_GROUP,
36
})
37
.options('proxy.secure', {
38
alias: ['secure'],
39
group: PROXY_GROUP,
40
})
41
.options('proxy.changeOrigin', {
42
describe: 'Proxy changes origin of requests',
43
group: PROXY_GROUP,
44
})
45
.options('proxy.disabled', {
46
describe: 'Disable proxy, only already cached files will be served.',
47
group: PROXY_GROUP,
48
})
49
.options('log', {
50
type: 'string',
51
describe: 'logging level [ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF]',
52
})
53
.help('help')
54
.version()
55
.alias('v', 'version')
56
.alias('h', 'help')
57
.wrap(null)
58
.argv;
59
60
module.exports = argv;
61
62