`fly launch` should accept an existing config file for multi-environment setups
Describe the bug
Fly launch should be able to accept an existing config file and use this configuration to 'launch' the application.
I've been working on a fly configuration but needed a separate staging environment. So I renamed my fly.toml file to fly.production.toml, copied it to fly.staging.toml and made some changes to the staging file.
Because fly launch --config ./fly.staging.toml is not possible, fly launch will create a separate/new fly.toml file which I don't need because I already created one.
So, instead of running:
fly launch --org my-organisation-name --name staging-my-app-name
You could do:
fly launch --config ./staging.fly.toml
And the name will automatically be fetched from the config.
-
Operating system
fly v0.0.325 darwin/arm64 Commit: da2b638 BuildDate: 2022-04-28T04:00:48Z
A follow-up to this could be to include a field for organization in the fly.toml specification (https://fly.io/docs/reference/configuration/). This way, you can omit --org my-organisation-name from fly launch as well.
My example of fly launch --config ./staging.fly.toml incorrectly assumed organization was already part of fly.toml.
Do you want me to create a separate ticket for it?
I'd love to be able to put fly.toml in some config folder :(
@vjanssens @suchy do you still need this?
Not at the moment but this is generally nice to have.
I will start implementing this and let you know how it goes in at most 7 days.
Amazing ;-)
@suchy is your use case covered by what @vjanssens has described?
Yes, 100%
What logic I am following:
- Try to launch an app from the provided path to a
fly.tomlfile. - If not found, fallback to current way.
Sounds correct 👍🏼 thanks
I am continuing my work on the --config flag, but I cannot make the decision to add the organization field to fly.toml.
Hopefully, a Fly.io employee decides in favor of adding that.
Initial implementation done, but there are things to be discussed with the Fly.io team in the coming days.
@suchy as promised, following up 7 days later. The Fly.io team seems to be working on higher priority issues for the moment and it might take some time for my PR to get the proper attention. Hope it's not a big problem for you!
Also, my PR aims to close #966 too, but I still need to add its implementation.
@redjonzaci thanks for your efforts ;-)