forked from Osthanes/container_deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cf_parser.js
30 lines (23 loc) · 822 Bytes
/
cf_parser.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
fs = require('fs');
parseconfig = function(configfile, callback){
fs.readFile(configfile, 'utf8', function (err, data) {
if (err) {
throw err;
}
cfconfig = JSON.parse(data);
console.log(cfconfig);
callback(cfconfig['OrganizationFields'].Name, cfconfig['SpaceFields'].Name, cfconfig.RefreshToken, cfconfig.AccessToken);
});
}
printInfo = function( org, space, refresh, bearer){
console.log("Cloud Foundry Information:")
console.log("org:" + org);
console.log("space:" + space);
console.log("refresh:" + refresh);
console.log("bearer:" + bearer);
}
exportInfo = function( org, space, refresh, bearer ){
console.log("export CF_BLUEMIX_ORG=" + org);
console.log("export CF_BLUEMIX_SPACE=" + space);
}
parseconfig(process.argv[2], exportInfo);