Skip to content

Conversation

javierav
Copy link

This PR allows you to configure SSHKit in a multithreaded environment per run. Currently, this isn't possible because much of the configuration is set in a global class variable under SSHKit.config.

While SSHKit is initially intended to run when using Capistrano or Kamal from the command line, where a global configuration is sufficient, if you want to use it to run commands via SSH from a Rails job and you want to configure things like the output log, the default environment, or the command map differently for each run, things get complicated.

Example

require 'sshkit'
require 'sshkit/dsl'
include SSHKit::DSL

config = SSHKit::Configuration.new.tap do |c|
  c.output = MyLogger.new
end

on "example.com", in: :sequence, config: config do |host|
  # ...
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant