Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use config object per running #555

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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