-
Notifications
You must be signed in to change notification settings - Fork 58
/
config.js
62 lines (46 loc) · 1.27 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const path = require('path');
const pkg = require('../package.json');
const rc = require('rc');
module.exports = function(options, params) {
// specify default configs
var config = rc(pkg.name, {
// version
version : params.version,
// global configs
global: {
// download dir
downloadDir : process.cwd(),
// editors by mime-type
editors: {
default: process.env.EDITOR,
},
// viewers by mime-type
viewers: {
default: 'xdg-open',
},
// terminal colors
color: {
error : 'red',
info : 'gray',
notice : 'yellow',
},
},
targets : {},
});
// append target configs to main configs
config.target = config.targets[options['<target>']];
// allow the trojanDir to be appended to
var trojandir = [ path.join(__dirname, '..', 'trojans') ];
if (options['--trojan-dir']) {
trojanDir.push(options['--trojan-dir']);
} else if (config.global.trojanDir) {
trojanDir.push(config.global.trojanDir);
}
config.global.trojanDir = trojandir;
// allow the downloadDir to be overriden
if (options['--download-dir']) {
config.global.downloadDir = options['--download-dir'];
}
// return the configs
return config;
};