Method: Net::SSH.configuration_for

Defined in:
lib/net/ssh.rb

.configuration_for(host, use_ssh_config) ⇒ Object

Returns a hash of the configuration options for the given host, as read from the SSH configuration file(s). If use_ssh_config is true (the default), this will load configuration from both ~/.ssh/config and /etc/ssh_config. If use_ssh_config is nil or false, nothing will be loaded (and an empty hash returned). Otherwise, use_ssh_config may be a file name (or array of file names) of SSH configuration file(s) to read.

See Net::SSH::Config for the full description of all supported options.



288
289
290
291
292
293
294
295
296
# File 'lib/net/ssh.rb', line 288

def self.configuration_for(host, use_ssh_config)
  files = case use_ssh_config
          when true then Net::SSH::Config.expandable_default_files
          when false, nil then return {}
          else Array(use_ssh_config)
          end

  Net::SSH::Config.for(host, files)
end