Class: Dendrite::Config
- Inherits:
-
Object
- Object
- Dendrite::Config
- Defined in:
- lib/dendrite.rb
Class Method Summary collapse
- .custom_frontend!(name:, port:, backend_name:) ⇒ Object
- .dc ⇒ Object
- .env ⇒ Object
- .fqdn ⇒ Object
- .global_haproxy_config ⇒ Object
- .instance ⇒ Object
- .load(source:) ⇒ Object
- .nerve_config_path ⇒ Object
- .public_ip ⇒ Object
- .services_source ⇒ Object
- .synapse_config_path ⇒ Object
- .valid_types ⇒ Object
- .zk_hosts ⇒ Object
Class Method Details
.custom_frontend!(name:, port:, backend_name:) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/dendrite.rb', line 49 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 ⇒ Object
25 26 27 |
# File 'lib/dendrite.rb', line 25 def dc @@data[:dendrite].fetch(:dc) end |
.env ⇒ Object
29 30 31 |
# File 'lib/dendrite.rb', line 29 def env @@data[:dendrite][:env] || :dev end |
.fqdn ⇒ Object
69 70 71 |
# File 'lib/dendrite.rb', line 69 def fqdn Socket.gethostbyname(Socket.gethostname).first end |
.global_haproxy_config ⇒ Object
45 46 47 |
# File 'lib/dendrite.rb', line 45 def global_haproxy_config @@data[:synapse][:haproxy] end |
.instance ⇒ Object
73 74 75 |
# File 'lib/dendrite.rb', line 73 def instance fqdn end |
.load(source:) ⇒ Object
17 18 19 |
# File 'lib/dendrite.rb', line 17 def load(source:) @@data = Dendrite::IO.read(source: source) end |
.nerve_config_path ⇒ Object
37 38 39 |
# File 'lib/dendrite.rb', line 37 def nerve_config_path @@data[:dendrite][:nerve_config_path] end |
.public_ip ⇒ Object
63 64 65 66 67 |
# File 'lib/dendrite.rb', line 63 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 |
.services_source ⇒ Object
21 22 23 |
# File 'lib/dendrite.rb', line 21 def services_source @@data[:dendrite].fetch(:services_source) end |
.synapse_config_path ⇒ Object
41 42 43 |
# File 'lib/dendrite.rb', line 41 def synapse_config_path @@data[:dendrite][:synapse_config_path] end |
.valid_types ⇒ Object
59 60 61 |
# File 'lib/dendrite.rb', line 59 def valid_types @@data[:dendrite][:valid_app_types] end |
.zk_hosts ⇒ Object
33 34 35 |
# File 'lib/dendrite.rb', line 33 def zk_hosts @@data[:dendrite][:zk_hosts] end |