Make kamal use ssh keys from config when performing commands
This commit is contained in:
committed by
Matteo Giaccone
parent
9cf8da64c4
commit
3fa9cd5a41
@@ -11,7 +11,7 @@ module Kamal::Commands
|
||||
end
|
||||
|
||||
def run_over_ssh(*command, host:)
|
||||
"ssh#{ssh_proxy_args} -t #{config.ssh.user}@#{host} -p #{config.ssh.port} '#{command.join(" ").gsub("'", "'\\\\''")}'"
|
||||
"ssh#{ssh_proxy_args}#{ssh_keys_args} -t #{config.ssh.user}@#{host} -p #{config.ssh.port} '#{command.join(" ").gsub("'", "'\\\\''")}'"
|
||||
end
|
||||
|
||||
def container_id_for(container_name:, only_running: false)
|
||||
@@ -94,5 +94,14 @@ module Kamal::Commands
|
||||
" -o ProxyCommand='#{config.ssh.proxy.command_line_template}'"
|
||||
end
|
||||
end
|
||||
|
||||
def ssh_keys_args
|
||||
args = ""
|
||||
config.ssh.keys&.each do |key|
|
||||
args << " -i #{key}"
|
||||
end
|
||||
args << " -o IdentitiesOnly=yes" if config.ssh&.keys_only
|
||||
args
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user