Reputation: 13
I am writing VueJS Web Application and deploying into Pivotal Cloud Foundry. I want to read config from user provided VCAP_SERVICES.
I tried two approach to do that.
Uncaught TypeError: Arguments to path.join must be strings
while var cfenv = require('cfenv')
let vcap_services = JSON.parse(process.env.VCAP_SERVICES)
, in this one i am getting VCAP_SERVICES undefined.Can anyone please help or suggest something.
Upvotes: 0
Views: 416
Reputation: 15051
You cannot look at VCAP_SERVICES
in a client's browser, which is where your Vue.js app is running. This is because VCAP_SERVICES
is an environment variable set on the server-side where your application is being hosted.
If you want it available on the client-side, you'd need to expose it in some way. Either encode it in the files being served up to the client's browser or make an API call and request it from your server.
That said, often the information in VCAP_SERVICES
is sensitive (contains passwords and secrets), so you'd want to be extremely careful about what you send down to the client/browser. Anything you send down to the client/browser will be visible to the client/browser and its human user. In short, someone using your app through a browser could also see that info, like through Browser Dev Tools.
Upvotes: 3