How can I see my VCAP_SERVICES environment variable with the cf program?

自闭症网瘾萝莉.ら 提交于 2019-12-12 13:12:24

问题


When I run cf env <app-name> it shows all the environment variables I've set with cf set-env, but I don't see the VCAP_SERVICES environment variable. How can I see that variable's value?


回答1:


As of version 6.10 of the cf program, the VCAP_SERVICES environment will now be displayed with the other environment variables, with the command cf env <app-name>.

To upgrade your cf program, download the appropriate version on the releases page: https://github.com/cloudfoundry/cli/releases




回答2:


cf env app-name gives VCAP_SERVICES values.




回答3:


Use the cf env command to view the Cloud Foundry environment variables for your application. cf env displays the following environment variables:

The VCAP_SERVICES variables existing in the container environment
The user-provided variables set using the cf set-env command

For details please refer:

http://docs.run.pivotal.io/devguide/deploy-apps/environment-variable.html




回答4:


cf env your-app-name gives VCAP_SERVICES values, but only when your application was bonded with service, else you will have only VCAP_APPLICATION variable.




回答5:


Here is the small snippet to list all the environment variables of PCF:

cf ssh <App_Name> -c "python -c 'import os, json; print(json.dumps({key:value for (key,value) in os.environ.items()}, indent = 2))'"

{
"INSTANCE_GUID": "315c18fb-e031-4e6e-67c4-84d1",
"CF_INSTANCE_PORT": "61064",
"CF_INSTANCE_KEY": "/etc/cf-instance-credentials/instance.key",
"USER": "vcap",
"INSTANCE_INDEX": "0",
.
.
.
.
"PWD": "/home/vcap",
"VCAP_APP_PORT": "8080"
}
}


来源:https://stackoverflow.com/questions/29550468/how-can-i-see-my-vcap-services-environment-variable-with-the-cf-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!