Module: Consulkit::Configurable
Overview
Constant Summary collapse
- CONFIGURABLE_KEYS =
%i[ connection_options http_addr http_token middleware ].freeze
Instance Attribute Summary collapse
-
#connection_options ⇒ Object
- Hash
-
Faraday connection options.
-
#http_addr ⇒ Object
- String
-
the HTTP(s) address to use to connect to Consul.
-
#http_token ⇒ Object
writeonly
- String
-
the ACL token used for authentication.
-
#middleware ⇒ Object
- Faraday::RackBuilder
-
middleware for Faraday.
Instance Method Summary collapse
Instance Attribute Details
#connection_options ⇒ Object
- Hash
-
Faraday connection options
14 15 16 |
# File 'lib/consulkit/configurable.rb', line 14 def @connection_options end |
#http_addr ⇒ Object
- String
-
the HTTP(s) address to use to connect to Consul
8 9 10 |
# File 'lib/consulkit/configurable.rb', line 8 def http_addr @http_addr end |
#http_token=(value) ⇒ Object (writeonly)
- String
-
the ACL token used for authentication
11 12 13 |
# File 'lib/consulkit/configurable.rb', line 11 def http_token=(value) @http_token = value end |
#middleware ⇒ Object
- Faraday::RackBuilder
-
middleware for Faraday
17 18 19 |
# File 'lib/consulkit/configurable.rb', line 17 def middleware @middleware end |
Instance Method Details
#options ⇒ Object
34 35 36 |
# File 'lib/consulkit/configurable.rb', line 34 def CONFIGURABLE_KEYS.to_h { |key| [key, instance_variable_get("@#{key}")] } end |
#setup! ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/consulkit/configurable.rb', line 26 def setup! CONFIGURABLE_KEYS.each do |key| instance_variable_set(:"@#{key}", Consulkit::Defaults.send(key)) end self end |