class Dendrite::Config

Public Class Methods

bind_to_all?() click to toggle source
# File lib/dendrite.rb, line 87
def bind_to_all?
  @@data[:dendrite][:bind_to_all] != nil
end
custom_frontend!(name:, port:, backend_name:) click to toggle source
# File lib/dendrite.rb, line 61
def custom_frontend!(name:, port:, backend_name:)
  data = {
    "frontend #{name}": [
      "bind :#{port}",
      "use_backend #{backend_name}"
    ]
  }
  @@data[:synapse][:haproxy][:extra_sections] = @@data[:synapse][:haproxy][:extra_sections].merge(data)
end
dc() click to toggle source
# File lib/dendrite.rb, line 26
def dc
  @@data[:dendrite].fetch(:dc)
end
default_check_time() click to toggle source
# File lib/dendrite.rb, line 91
def default_check_time
  @@data[:dendrite][:check_internal] || 5
end
env() click to toggle source
# File lib/dendrite.rb, line 30
def env
  @@data[:dendrite][:env] || :dev
end
fqdn() click to toggle source
# File lib/dendrite.rb, line 101
def fqdn
  Socket.gethostbyname(Socket.gethostname).first
end
global_haproxy_config() click to toggle source
# File lib/dendrite.rb, line 46
def global_haproxy_config
  @@data[:synapse][:haproxy]
end
http_types() click to toggle source
# File lib/dendrite.rb, line 75
def http_types
  @@data[:dendrite][:http_app_types] || []
end
instance() click to toggle source
# File lib/dendrite.rb, line 105
def instance
  fqdn
end
load(source:) click to toggle source
# File lib/dendrite.rb, line 18
def load(source:)
  @@data = Dendrite::IO.read(source: source)
end
nerve_config_path() click to toggle source
# File lib/dendrite.rb, line 38
def nerve_config_path
  @@data[:dendrite][:nerve_config_path]
end
peer() click to toggle source
# File lib/dendrite.rb, line 54
def peer
  if @@data[:synapse][:haproxy][:extra_sections]
    key = @@data[:synapse][:haproxy][:extra_sections].keys.collect(&:to_s).find {|k| k.include?("peers")}
    key ? key.split("peers").last.strip : nil
  end
end
public_ip() click to toggle source
# File lib/dendrite.rb, line 95
def public_ip
  ip = Socket.ip_address_list.detect{|intf| intf.ipv4_private?} ||
       Socket.ip_address_list.detect{|intf| intf.ipv4? && !intf.ipv4_loopback? && !intf.ipv4_multicast? && !intf.ipv4_private?}
  ip.ip_address if ip
end
server_options() click to toggle source
# File lib/dendrite.rb, line 50
def server_options
  @@data[:synapse][:server_options]
end
services_source() click to toggle source
# File lib/dendrite.rb, line 22
def services_source
  @@data[:dendrite].fetch(:services_source)
end
sticky() click to toggle source
# File lib/dendrite.rb, line 83
def sticky
  @@data[:dendrite][:sticky]
end
synapse_config_path() click to toggle source
# File lib/dendrite.rb, line 42
def synapse_config_path
  @@data[:dendrite][:synapse_config_path]
end
valid_types() click to toggle source
# File lib/dendrite.rb, line 71
def valid_types
  @@data[:dendrite][:valid_app_types]
end
zk_hosts() click to toggle source
# File lib/dendrite.rb, line 34
def zk_hosts
  @@data[:dendrite][:zk_hosts]
end