Module: Capistrano::Consul

Defined in:
lib/capistrano/consul.rb,
lib/capistrano/consul/version.rb

Constant Summary collapse

VERSION =
"0.3.4"

Class Method Summary collapse

Class Method Details

.setupObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/capistrano/consul.rb', line 7

def self.setup
  return if @url
  @url = fetch(:consul_url)
  @token = fetch(:consul_token)
  return false unless @url
  @ssh_gateway = fetch(:consul_ssh_gateway)
  if @ssh_gateway
    @gateway = Net::SSH::Gateway.new(@ssh_gateway[:host], @ssh_gateway[:username] || @ssh_gateway[:user], @ssh_gateway[:options] || {})
    @gateway.open('127.0.0.1', @ssh_gateway[:port], @ssh_gateway[:port])
  end

  Diplomat.configure do |config|
    config.url = @url
    if @token
      config.acl_token = @token
    end
  end
end