简体   繁体   中英

Escaping special characters in VCAP_SERVICES

I am having some problems when I try to put some "special" character as value of my environment variable like ! ' % ! ' % etc.

Is there a way to escape them?

在此处输入图片说明

Based on what I found it is not possible to use special characters in VCAP_SERVICES and VCAP_APPLICATION , probably because of security concerns.

The workaround would be to create a user-provided service , define the variable there, bind the service to the app and retrieve the information via the service.

For ordinary user-added environment variables (ie not VCAP_*), the command line will let you do it as long as you escape them from the shell in the usual ways. Eg here I used single quotes:

$ cf set-env mjfmsb DUDE '!@#$%^&*()'
Setting env variable 'DUDE' to '!@#$%^&*()' for app mjfmsb in org mfraioli / space dev as mfraioli...
OK
TIP: Use 'cf restage mjfmsb' to ensure your env variable changes take effect
$ cf env mjfmsb | grep DUDE
DUDE: !@#$%^&*()

Not sure why the dashboard doesn't allow the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM