Skip to content

Commit

Permalink
Actually pass ssh/config through to SSHKit options
Browse files Browse the repository at this point in the history
This option is documented as available since basecamp#908 in:
https://github.com/basecamp/kamal/blob/74a06b0ccda616c86ebe1729d0795f39bcac9f00/lib/kamal/configuration/docs/ssh.yml#L65-L70

However, before this the options don't seem to pass through to SSHKit:
https://github.com/basecamp/kamal/blob/74a06b0ccda616c86ebe1729d0795f39bcac9f00/lib/kamal/commander.rb#L167

Since `config` isn't actually returned in `#options`.
  • Loading branch information
Burgestrand committed Oct 28, 2024
1 parent 2465681 commit 0bfb018
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/kamal/configuration/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ def key_data
ssh_config["key_data"]
end

def config
ssh_config["config"]
end

def options
{ user: user, port: port, proxy: proxy, logger: logger, keepalive: true, keepalive_interval: 30, keys_only: keys_only, keys: keys, key_data: key_data }.compact
{ user: user, port: port, proxy: proxy, logger: logger, keepalive: true, keepalive_interval: 30, keys_only: keys_only, keys: keys, key_data: key_data, config: config }.compact
end

def to_h
Expand Down
5 changes: 5 additions & 0 deletions test/configuration/ssh_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ class ConfigurationSshTest < ActiveSupport::TestCase
config = Kamal::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "proxy" => "[email protected]" }) })
assert_equal "[email protected]", config.ssh.options[:proxy].jump_proxies
end

test "ssh options with disabled ssh_config" do
config = Kamal::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "config" => false }) })
assert_equal false, config.ssh.options[:config]
end
end

0 comments on commit 0bfb018

Please sign in to comment.