Reputation: 493
I am working on the Node.js project and need to login to Cloud Foundry and read environmental variables (basically, credentials) of one application. So far, I was able to login and target the correct organization with the help of '@sap/cf-tools' package. Now, the last step remains, the equivalent of command
cf env APP_NAME
The problem is that '@sap/cf-tools' doesnt support yet this functionality and I haven't found any other which would do it. Did someone else face this problem and if yes, how did you solve it? Is there some npm package I have overlooked? Or I will be forced to run "cf env" with "-v" parameter and try to get to the desired EnvVariables through the series of axios calls? Thank you.
Upvotes: 0
Views: 1815
Reputation: 21
There's no need to use a series of Axios calls. Take a look at the following package https://www.npmjs.com/package/@sap/xsenv. It should fit your use case.
var xsenv = require('@sap/xsenv');
var services = xsenv.readServices();
var svc = services[process.env.SERVICE_NAME];
Upvotes: 2