module Vault::Rails::Configurable
Public Instance Methods
The name of the Vault::Rails
application.
@raise [RuntimeError]
if the application has not been set
@return [String]
# File lib/vault/rails/configurable.rb, line 15 def application if defined?(@application) && !@application.nil? return @application end if ENV.has_key?("VAULT_RAILS_APPLICATION") return ENV["VAULT_RAILS_APPLICATION"] end raise RuntimeError, "Must set `Vault::Rails#application'!" end
Set the name of the application.
@param [String] val
# File lib/vault/rails/configurable.rb, line 28 def application=(val) @application = val end
Gets the default role name.
@return [String]
# File lib/vault/rails/configurable.rb, line 135 def default_role_name @default_role_name end
Sets the default role to use with various plugins.
@param [String] val
# File lib/vault/rails/configurable.rb, line 142 def default_role_name=(val) @default_role_name = val end
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.
@return [true, false]
# File lib/vault/rails/configurable.rb, line 38 def enabled? if defined?(@enabled) && !@enabled.nil? return @enabled end if ENV.has_key?("VAULT_RAILS_ENABLED") return (ENV["VAULT_RAILS_ENABLED"] == "true") end return false end
Sets whether warnings about in-memory ciphers are enabled. Users can set this in an initializer depending on their Rails
environment.
@example
Vault.configure do |vault| vault.in_memory_warnings_enabled = !Rails.env.test? end
@return [true, false]
# File lib/vault/rails/configurable.rb, line 83 def in_memory_warnings_enabled=(val) @in_memory_warnings_enabled = val end
Whether warnings about in-memory ciphers are enabled. The default value is ‘true`, which means vault-rails will log a warning for every attempt to encrypt or decrypt using an in-memory cipher. This is useful for development and testing.
@return [true, false]
# File lib/vault/rails/configurable.rb, line 67 def in_memory_warnings_enabled? if !defined?(@in_memory_warnings_enabled) || @in_memory_warnings_enabled.nil? return true end return @in_memory_warnings_enabled end
Gets the number of retry attempts.
@return [Fixnum]
# File lib/vault/rails/configurable.rb, line 90 def retry_attempts @retry_attempts ||= 0 end
Sets the number of retry attempts. Please see the Vault
documentation for more information.
@param [Fixnum] val
# File lib/vault/rails/configurable.rb, line 98 def retry_attempts=(val) @retry_attempts = val end
Gets the number of retry attempts.
@return [Fixnum]
# File lib/vault/rails/configurable.rb, line 105 def retry_base @retry_base ||= Vault::Defaults::RETRY_BASE end
Sets the retry interval. Please see the Vault
documentation for more information.
@param [Fixnum] val
# File lib/vault/rails/configurable.rb, line 113 def retry_base=(val) @retry_base = val end
Gets the retry maximum wait.
@return [Fixnum]
# File lib/vault/rails/configurable.rb, line 120 def retry_max_wait @retry_max_wait ||= Vault::Defaults::RETRY_MAX_WAIT end
Sets the maximum amount of time for a single retry. Please see the Vault
documentation for more information.
@param [Fixnum] val
# File lib/vault/rails/configurable.rb, line 128 def retry_max_wait=(val) @retry_max_wait = val end