-
Notifications
You must be signed in to change notification settings - Fork 1
/
utility.js
40 lines (35 loc) · 1022 Bytes
/
utility.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
exports.collect = function(val, memo) {
memo.push(val);
return memo;
};
exports.parseConfig = function(program, target) {
var config = {
provider: program[target + 'Type']
};
switch (config.provider) {
case 'amazon':
config.keyId = program[target + 'Key'];
config.key = program[target + 'Secret'];
break;
case 'rackspace':
config.username = program[target + 'Key'];
config.apiKey = program[target + 'Secret'];
break;
case 'openstack':
config.username = program[target + 'Key'];
config.password = program[target + 'Secret'];
break;
case 'hp':
config.username = program[target + 'Key'];
config.apiKey = program[target + 'Secret'];
break;
case 'google':
config.projectId = program[target + 'Key'];
config.keyFilename = program[target + 'Secret'];
break;
}
if (program[target + 'Region']) {
config.region = program[target + 'Region'];
}
return config;
};