flyctl with multiple fly.toml files

Is there a way to tell flyctl to pick up fly2.toml on launches and deploys instead of the default fly.toml?

I think you would just have to rename the fly2.toml to fly.toml and move/delete the old fly.toml.

The flyctl will only run the file labeled ‘fly.toml’ file

1 Like

Looking at flyctl code, it probably shouldn’t be hard to add support for this.

Another approach that would work for us is if fly.toml supported environment-specific config, like say dev, staging, prod, v1, v2 etc. Is that in the pipeline?

I’m aware there’s a way to do per-PR deploys, but that is quite what we are looking for.

Would the --config flag be what you need?

Haven’t tried it myself but maybe it’s as simple as fly deploy --config fly2.toml?

2 Likes

flyctl with --config switch should work! Let me try it the next time I’m at my desk.

Thanks!

1 Like

Does anyone have a solution for flyctl launch? It’d be nice if it had a --config flag also.

Hey @Matt_Stewart-Ronnisc, what use case do have in mind?

We have the following fly config files:

fly.staging.toml
fly.production.toml
fly.pull_request_preview.toml

For some reason the launch command doesn’t support this option. This seems like its one of the most important commands that should support this.