Module: Vault::Rails::Configurable
- Includes:
- Configurable
- Defined in:
- lib/vault/rails/configurable.rb
Instance Method Summary collapse
-
#application ⇒ String
The name of the Vault::Rails application.
-
#application=(val) ⇒ Object
Set the name of the application.
-
#default_role_name ⇒ String
Gets the default role name.
-
#default_role_name=(val) ⇒ Object
Sets the default role to use with various plugins.
-
#enabled=(val) ⇒ true, false
Sets whether Vault is enabled.
-
#enabled? ⇒ true, false
Whether the connection to Vault is enabled.
-
#in_memory_warnings_enabled=(val) ⇒ true, false
Sets whether warnings about in-memory ciphers are enabled.
-
#in_memory_warnings_enabled? ⇒ true, false
Whether warnings about in-memory ciphers are enabled.
-
#retry_attempts ⇒ Fixnum
Gets the number of retry attempts.
-
#retry_attempts=(val) ⇒ Object
Sets the number of retry attempts.
-
#retry_base ⇒ Fixnum
Gets the number of retry attempts.
-
#retry_base=(val) ⇒ Object
Sets the retry interval.
-
#retry_max_wait ⇒ Fixnum
Gets the retry maximum wait.
-
#retry_max_wait=(val) ⇒ Object
Sets the maximum amount of time for a single retry.
Instance Method Details
#application ⇒ String
The name of the Vault::Rails application.
15 16 17 18 19 20 21 22 23 |
# 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 |
#application=(val) ⇒ Object
Set the name of the application.
28 29 30 |
# File 'lib/vault/rails/configurable.rb', line 28 def application=(val) @application = val end |
#default_role_name ⇒ String
Gets the default role name.
135 136 137 |
# File 'lib/vault/rails/configurable.rb', line 135 def default_role_name @default_role_name end |
#default_role_name=(val) ⇒ Object
Sets the default role to use with various plugins.
142 143 144 |
# File 'lib/vault/rails/configurable.rb', line 142 def default_role_name=(val) @default_role_name = val end |
#enabled=(val) ⇒ true, false
Sets whether Vault is enabled. Users can set this in an initializer depending on their Rails environment.
57 58 59 |
# File 'lib/vault/rails/configurable.rb', line 57 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.
38 39 40 41 42 43 44 45 46 |
# 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 |
#in_memory_warnings_enabled=(val) ⇒ true, false
Sets whether warnings about in-memory ciphers are enabled. Users can set this in an initializer depending on their Rails environment.
83 84 85 |
# File 'lib/vault/rails/configurable.rb', line 83 def in_memory_warnings_enabled=(val) @in_memory_warnings_enabled = val end |
#in_memory_warnings_enabled? ⇒ true, false
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.
67 68 69 70 71 72 |
# 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 |
#retry_attempts ⇒ Fixnum
Gets the number of retry attempts.
90 91 92 |
# File 'lib/vault/rails/configurable.rb', line 90 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.
98 99 100 |
# File 'lib/vault/rails/configurable.rb', line 98 def retry_attempts=(val) @retry_attempts = val end |
#retry_base ⇒ Fixnum
Gets the number of retry attempts.
105 106 107 |
# File 'lib/vault/rails/configurable.rb', line 105 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.
113 114 115 |
# File 'lib/vault/rails/configurable.rb', line 113 def retry_base=(val) @retry_base = val end |
#retry_max_wait ⇒ Fixnum
Gets the retry maximum wait.
120 121 122 |
# File 'lib/vault/rails/configurable.rb', line 120 def retry_max_wait @retry_max_wait ||= Vault::Defaults::RETRY_MAX_WAIT end |
#retry_max_wait=(val) ⇒ Object
Sets the maximum amount of time for a single retry. Please see the Vault documentation for more information.
128 129 130 |
# File 'lib/vault/rails/configurable.rb', line 128 def retry_max_wait=(val) @retry_max_wait = val end |