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?

4 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
1 Like

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.

1 Like

Would be fantastic if I could extend/inherit a fly.toml from another one, so let’s say have fly.toml be the main config, then fly.prod.toml inherit and just override a couple things, right now specifically min_machines_running which I’d like to have 0 in fly.toml (staging) and 1 in fly.prod.toml and define different names obvi :innocent:

Is there already a way? going to duplicate for now but would be a nice maintenance simplification

1 Like

Totally agree to this idea! Would make this DRY.

Not against inheritance here, but

  1. its not in the toml spec so it would require something thats not really well defined, and
  2. I’d rather they focus on core features like being able to specify which config file to use which seems like a necessity.

So maybe consider that inheritance a different feature request unrelated to specifying which config file to use on the command line.

1 Like

From How To to Questions / Help

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