I have a .NET core webapi running on PCF, Ive Create a user-provided service (cups) that contain my database credentials
cf cups my-proj-db -p '{"username":"dba", "password":"dbapass", "server":"whateverserver:1433", "database":"schools"}'
when I log onto PCF and go to
Settings->Environment Variables->View Env Vars
I am able to see the username, db, etc under
"system_env_json": {
"VCAP_SERVICES": {
"user-provided": [...
Now i want to retrieve the DB values so in my .NET code I do
Environment.GetEnvironmentVariable("vcap.services.my-proj-db.credentials.server",EnvironmentVariableTarget.Process)
I also tired EnvironmentVariableTarget.Machine & EnvironmentVariableTarget.User
but the value is always null, I know in Java this is how they retrieve it, but how do i do it in .NET core?
Just a side note, if i add a costume variable directly to PCF like
cf set-env my-app-name ENV_VAR_NAME MyFunkyName
I am able to get the value by
Environment.GetEnvironmentVariable("ENV_VAR_NAME", EnvironmentVariableTarget.Process)
Appreciate the help!!