Class: Gorynich::Fetchers::ConsulSecure
- Inherits:
-
Object
- Object
- Gorynich::Fetchers::ConsulSecure
- Defined in:
- lib/gorynich/fetchers/consul_secure.rb
Instance Attribute Summary collapse
-
#consul_opts ⇒ Object
readonly
Returns the value of attribute consul_opts.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(storage:, file_path:, **opts) ⇒ ConsulSecure
constructor
A new instance of ConsulSecure.
Constructor Details
permalink #initialize(storage:, file_path:, **opts) ⇒ ConsulSecure
Returns a new instance of ConsulSecure.
6 7 8 9 10 |
# File 'lib/gorynich/fetchers/consul_secure.rb', line 6 def initialize(storage:, file_path:, **opts) @storage = storage @file_path = file_path @consul_opts = opts end |
Instance Attribute Details
permalink #consul_opts ⇒ Object (readonly)
Returns the value of attribute consul_opts.
4 5 6 |
# File 'lib/gorynich/fetchers/consul_secure.rb', line 4 def consul_opts @consul_opts end |
permalink #file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
4 5 6 |
# File 'lib/gorynich/fetchers/consul_secure.rb', line 4 def file_path @file_path end |
permalink #storage ⇒ Object (readonly)
Returns the value of attribute storage.
4 5 6 |
# File 'lib/gorynich/fetchers/consul_secure.rb', line 4 def storage @storage end |
Instance Method Details
permalink #fetch ⇒ Object
[View source]
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gorynich/fetchers/consul_secure.rb', line 12 def fetch cfg = Consul.new(storage: storage, **consul_opts).fetch return from_file if cfg.empty? save_to_file(cfg) cfg rescue ::StandardError from_file end |