Class: ActiveSupport::EncryptedConfiguration
- Inherits:
-
EncryptedFile
- Object
- EncryptedFile
- ActiveSupport::EncryptedConfiguration
- Defined in:
- activesupport/lib/active_support/encrypted_configuration.rb
Constant Summary
Constants inherited from EncryptedFile
ActiveSupport::EncryptedFile::CIPHER
Instance Attribute Summary
Attributes inherited from EncryptedFile
#content_path, #env_key, #key_path, #raise_if_missing_key
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(config_path:, key_path:, env_key:, raise_if_missing_key:) ⇒ EncryptedConfiguration
constructor
A new instance of EncryptedConfiguration.
-
#read ⇒ Object
Allow a config to be started without a file present.
- #write(contents) ⇒ Object
Methods inherited from EncryptedFile
Constructor Details
#initialize(config_path:, key_path:, env_key:, raise_if_missing_key:) ⇒ EncryptedConfiguration
Returns a new instance of EncryptedConfiguration.
14 15 16 17 |
# File 'activesupport/lib/active_support/encrypted_configuration.rb', line 14 def initialize(config_path:, key_path:, env_key:, raise_if_missing_key:) super content_path: config_path, key_path: key_path, env_key: env_key, raise_if_missing_key: raise_if_missing_key end |
Instance Method Details
#config ⇒ Object
32 33 34 |
# File 'activesupport/lib/active_support/encrypted_configuration.rb', line 32 def config @config ||= deserialize(read).deep_symbolize_keys end |
#read ⇒ Object
Allow a config to be started without a file present
20 21 22 23 24 |
# File 'activesupport/lib/active_support/encrypted_configuration.rb', line 20 def read super rescue ActiveSupport::EncryptedFile::MissingContentError "" end |
#write(contents) ⇒ Object
26 27 28 29 30 |
# File 'activesupport/lib/active_support/encrypted_configuration.rb', line 26 def write(contents) deserialize(contents) super end |