module Capistrano::Consul

Constants

VERSION

Public Class Methods

setup() click to toggle source
# 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