class Philae::NSQProbe
Public Class Methods
new(name, host, port = 4151, tls_context = nil, opts = {})
click to toggle source
# File lib/philae/nsq_probe.rb, line 17 def initialize(name, host, port = 4151, tls_context = nil, opts = {}) @name = name scheme = "http" if !tls_context.nil? scheme = "https" end @uri = "#{scheme}://#{host}:#{port}/ping" @tls_context = tls_context @timeout = opts.fetch(:timeout, 5) end
new_from_env(name, opts = {})
click to toggle source
# File lib/philae/nsq_probe.rb, line 5 def self.new_from_env(name, opts = {}) if ENV["NSQD_TLS"] == "true" return self.new(name, ENV["NSQD_HOST"], ENV["NSQD_HTTP_PORT"], { cert: ENV["NSQD_TLS_CERT"], key: ENV["NSQD_TLS_KEY"], ca: ENV["NSQD_TLS_CACERT"], }, opts) else return self.new(name, ENV["NSQD_HOST"], ENV["NSQD_HTTP_PORT"]) end end