Sha256: 5456d4c323251a2891ae1e052929c3635fc95261d0ebf802334072d04439b9fe

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

require 'metaractor'
require 'excon'

module ConsulBridge
  class DetectConsul
    include Metaractor

    URL = 'http://127.0.0.1:8500/v1/agent/self'.freeze

    def call
      running = true
      begin
        Excon.get(
          URL,
          expects: [200],
          connect_timeout: 5,
          read_timeout: 5,
          write_timeout: 5,
          tcp_nodelay: true
        )
      rescue Excon::Errors::SocketError, Excon::Errors::HTTPStatusError
        running = false
      end

      context.running = running
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
consul_bridge-0.1.5 lib/consul_bridge/detect_consul.rb