Module: Vault::Transit::Configurable

Includes:
Configurable
Defined in:
lib/vault/transit/configurable.rb

Instance Method Summary collapse

Instance Method Details

#enabled=(val) ⇒ true, false

Sets whether Vault is enabled. Users can set this in an initializer depending on their Rails environment.

Examples:

Vault.configure do |vault|
  vault.enabled = Rails.env.production?
end

Returns:

  • (true, false)


28
29
30
# File 'lib/vault/transit/configurable.rb', line 28

def enabled=(val)
  @enabled = !!val
end

#enabled?true, false

Whether the connection to Vault is enabled. The default value is ‘false`, which means vault-rails will perform in-memory encryption/decryption and not attempt to talk to a real Vault server. This is useful for development and testing.

Returns:

  • (true, false)


12
13
14
15
16
17
# File 'lib/vault/transit/configurable.rb', line 12

def enabled?
  if !defined?(@enabled) || @enabled.nil?
    return false
  end
  return @enabled
end

#retry_attemptsFixnum

Gets the number of retry attempts.

Returns:

  • (Fixnum)


35
36
37
# File 'lib/vault/transit/configurable.rb', line 35

def retry_attempts
  @retry_attempts ||= 0
end

#retry_attempts=(val) ⇒ Object

Sets the number of retry attempts. Please see the Vault documentation for more information.

Parameters:

  • val (Fixnum)


43
44
45
# File 'lib/vault/transit/configurable.rb', line 43

def retry_attempts=(val)
  @retry_attempts = val
end

#retry_baseFixnum

Gets the number of retry attempts.

Returns:

  • (Fixnum)


50
51
52
# File 'lib/vault/transit/configurable.rb', line 50

def retry_base
  @retry_base ||= Vault::Defaults::RETRY_BASE
end

#retry_base=(val) ⇒ Object

Sets the retry interval. Please see the Vault documentation for more information.

Parameters:

  • val (Fixnum)


58
59
60
# File 'lib/vault/transit/configurable.rb', line 58

def retry_base=(val)
  @retry_base = val
end

#retry_max_waitFixnum

Gets the retry maximum wait.

Returns:

  • (Fixnum)


65
66
67
# File 'lib/vault/transit/configurable.rb', line 65

def retry_max_wait
  @retry_max_wait ||= Vault::Defaults::RETRY_MAX_WAIT
end

#retry_max_wait=(val) ⇒ Object

Sets the naximum amount of time for a single retry. Please see the Vault documentation for more information.

Parameters:

  • val (Fixnum)


73
74
75
# File 'lib/vault/transit/configurable.rb', line 73

def retry_max_wait=(val)
  @retry_max_wait = val
end