Re: Environment variables with special characters not handled correctly?


Dieu Cao <dcao@...>
 

Hi Jonas,

You'll need to escape the special characters like $.
See this tracker story for some background:
https://www.pivotaltracker.com/story/show/76655240

-Dieu

On Thu, Sep 24, 2015 at 11:14 AM, Daniel Mikusa <dmikusa(a)pivotal.io> wrote:

It's possible that your shell is escaping the characters, like the '$'.

Try `cf set-env appname WORDPRESS_BEARER
'1NNKhb5&Nfw$F(wqbqW&9nSeoonwAYz7#j2M1KKY!QU(Wbs(a)8xwjr6Q$hg(IPqcd'`.
Note the single quotes around the value of the environment variable. Or
set the environment variable in a manifest.yml file.

Also, run `cf env <app-name>` to confirm the value is being set correctly.

Thanks,

Dan


On Thu, Sep 24, 2015 at 1:57 PM, Jonas Rosland <jonas.rosland(a)emc.com>
wrote:

Hi all,

I am having an issue with an environment variable containing special
characters that doesn't seem to picked up correctly by CF.

I run `cf set-env appname WORDPRESS_BEARER
1NNKhb5&Nfw$F(wqbqW&9nSeoonwAYz7#j2M1KKY!QU(Wbs(a)8xwjr6Q$hg(IPqcd`
(obviously not my currently correct key) and then use it in this Ruby app:
https://gist.github.com/jonasrosland/08b5758eaa9098a81cf8

When I check the output the app complains about the API key being
incorrect, when it is, in fact, correct. If I set it manually in the
application it works, but that is of course not a good practice. I've also
verified that the environment variable does get picked up by the
application by adding some logging output to show the API key, but it still
won't work. I'm wondering if this is because of the special characters in
the environment variable?

Thanks in advance,
Jonas Rosland

Join {cf-dev@lists.cloudfoundry.org to automatically receive all group messages.