Module: VaultApi::Configuration

Included in:
VaultApi
Defined in:
lib/vault_api/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
%i[
  address
  token
  user
  password
  env

  logger
].freeze
DEFAULT_ADDRESS =

By default use the main api URL.

''

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

When this module is extended, reset all settings.



35
36
37
# File 'lib/vault_api/configuration.rb', line 35

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Convenience method to allow configuration options to be set in a block

Yields:

  • (_self)

Yield Parameters:



24
25
26
# File 'lib/vault_api/configuration.rb', line 24

def configure
  yield self
end

#optionsObject



28
29
30
31
32
# File 'lib/vault_api/configuration.rb', line 28

def options
  VALID_OPTIONS_KEYS.each_with_object({}) do |key, option|
    option[key] = send(key)
  end
end

#resetObject

Reset all configuration settings to default values.



40
41
42
43
# File 'lib/vault_api/configuration.rb', line 40

def reset
  self.address = DEFAULT_ADDRESS
  # self.adapter  = DEFAULT_ADAPTER
end