How to separate different envs with different fly secret and fly.toml

I have two questions about deploying to different environments:

  1. Can we customize a different .toml file to deploy to different environments?
  2. How to separate different secrets for different environments with the same key but different values?

You can pass -c flag to most commands so for example create a staging env like:

fly launch -c fly.staging.toml

# And you can set secrets specific to that app using:
fly secrets set KEY=VALUE -c fly.staging.toml

Whenever you want to deploy just use fly deploy to use fly.toml (default) or fly deploy -c fly.staging.toml.

If you use GitHub actions you can even:

And if you want isolation between environments (for example to give access for staging for some folks but not prod):

1 Like

Many thanks! I will try that, I use GitHub.

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