From my personal apps that need production, staging and local environments I’ve used a simple approach:
- Add
.env
to your .dockerignore so your local env doesn’t go anywhere - Create a production app and commit the fly.toml. Now you can
fly deploy
to production. - Create another app and save the toml file with other name like
fly.staging.toml
. Now you canfly deploy -c fly.staging.toml
to staging. - Set secrets as
fly secrets set SOME_ENV=supersecret
for prod andfly secrets set -c fly.staging.toml SOME_ENV=supersecret
for staging. - Use
[env]
in your toml only for things that are ok to be public likeNODE_ENV
orTZ
.
Hopefully this will be helpful