Adding environment variables at deploy time

I’m attempting to provide the current git sha as a RELEASE_VERSION env variable to our app (elixir/pheonix).

My approach has been to add it during the deploy using the following command:

flyctl deploy --config <path to config toml> --env RELEASE_VERSION=test123

This succeeds in setting RELEASE_VERSION=test123 in the deployed VM, but it also causes none of the variables defined in the [env] section of my toml config file to be applied.

If I omit the --env flag from the deploy command than the toml [env] variables are applied.

Is there a way to get both? Or a different approach I should be taking?

This doesn’t really feel like a use case for secrets but I can try that route :man_shrugging:

It’s a known bug, unfortunately. See:

For now give fly secrets a try to bypass it. Yes the values aren’t secret but they will appear as environment variables too.

Ah, thanks for the pointer! I should’ve checked the open flyctl issues first :slight_smile: