basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
10.6k stars 408 forks source link

Allow setting a default destination #1025

Open jeromedalbert opened 2 days ago

jeromedalbert commented 2 days ago

I have a config/deploy.yml with common configuration options, and a config/deploy.production.yml. I could very well have a config/deploy.staging.yml or what have you.

Whenever I deploy, I find it a bit of a hassle to always type kamal deploy -d production.

Would it make sense to add an option to somehow configure a default destination? Maybe something like default_destination: production in config/deploy.yml, or somewhere else.

In the meantime, I have the following hacky workaround in my bin/kamal Rails binstub:

...

# Make production the default Kamal destination
require 'thor'
destination =
  Thor::Options.new(_: Thor::Option.new(:destination, { aliases: '-d' })).parse(ARGV)['destination']
if destination.nil?
  destination = 'production'
  ARGV.push('-d', 'production')
end

load Gem.bin_path('kamal', 'kamal')