Class: EtcdDiscovery::Config
- Inherits:
-
Object
- Object
- EtcdDiscovery::Config
- Defined in:
- lib/etcd-discovery/config.rb
Instance Attribute Summary collapse
-
#cacert ⇒ Object
Returns the value of attribute cacert.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#register_renew ⇒ Object
Returns the value of attribute register_renew.
-
#register_ttl ⇒ Object
Returns the value of attribute register_ttl.
-
#ssl_cert ⇒ Object
Returns the value of attribute ssl_cert.
-
#ssl_key ⇒ Object
Returns the value of attribute ssl_key.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 16 |
# File 'lib/etcd-discovery/config.rb', line 10 def initialize @use_ssl = false @host = "localhost" @port = "2379" @register_ttl = 10 @register_renew = 8 end |
Instance Attribute Details
#cacert ⇒ Object
Returns the value of attribute cacert.
6 7 8 |
# File 'lib/etcd-discovery/config.rb', line 6 def cacert @cacert end |
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/etcd-discovery/config.rb', line 8 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/etcd-discovery/config.rb', line 8 def port @port end |
#register_renew ⇒ Object
Returns the value of attribute register_renew.
7 8 9 |
# File 'lib/etcd-discovery/config.rb', line 7 def register_renew @register_renew end |
#register_ttl ⇒ Object
Returns the value of attribute register_ttl.
7 8 9 |
# File 'lib/etcd-discovery/config.rb', line 7 def register_ttl @register_ttl end |
#ssl_cert ⇒ Object
Returns the value of attribute ssl_cert.
6 7 8 |
# File 'lib/etcd-discovery/config.rb', line 6 def ssl_cert @ssl_cert end |
#ssl_key ⇒ Object
Returns the value of attribute ssl_key.
6 7 8 |
# File 'lib/etcd-discovery/config.rb', line 6 def ssl_key @ssl_key end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
6 7 8 |
# File 'lib/etcd-discovery/config.rb', line 6 def use_ssl @use_ssl end |
Instance Method Details
#client ⇒ Object
30 31 32 |
# File 'lib/etcd-discovery/config.rb', line 30 def client @client ||= Client.create self end |
#validate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/etcd-discovery/config.rb', line 18 def validate if use_ssl if cacert.nil? or !File.exists? cacert raise InvalidSSLConfig, "cacert" elsif ssl_key.nil? or !File.exists? ssl_key raise InvalidSSLConfig, "ssl_key" elsif ssl_cert.nil? or !File.exists? ssl_cert raise InvalidSSLConfig, "ssl_cert" end end end |