Environment Secrets Beginning With Dollar Signs

The docs give an example of a secret set as an environment variable prefixed with a dollar sign $.

Are they actually prefixed with a dollar sign, or are the docs just showing how to access an environment variable in a shell?

If the environment variables are prefixed with a dollar sign, how the heck do you set an environment variable that starts with a dollar in your own shell for testing purposes?

The docs page, for reference: Secrets and Fly Apps · Fly Docs

It’s showing how to access the variable in a shell. I’m not sure if this is the correct thing to do there!
But I also don’t think it’s possible to actually set an environment variable that starts with a dollar sign, at least in a POSIX-compatible shell. (It is possible in Fly.io VMs though if you set it in your fly.toml, if you really want to do that…)

That dollar sign seems unnecessary. I’ve removed it (forgiveness/permission and all that).

Bash/zsh users will know to add the dollar sign.

Powershell users will add $Env:. Python, os.environ, Ruby, ENV, Node: process.env, etc.

2 Likes

Thanks for sorting that out.

I thought it was just showing shell variable syntax, but I did spend way to much time trying to set a shell variable starting with a dollar sign. ¯_(ツ)_/¯

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.