Class: Portunus::Configuration
- Inherits:
-
Object
- Object
- Portunus::Configuration
- Defined in:
- lib/portunus/configuration.rb
Instance Attribute Summary collapse
-
#encrypter ⇒ Object
Returns the value of attribute encrypter.
-
#max_key_duration ⇒ Object
Returns the value of attribute max_key_duration.
-
#storage_adaptor ⇒ Object
Returns the value of attribute storage_adaptor.
Instance Method Summary collapse
- #add_key(key_name) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #keys_loaded? ⇒ Boolean
- #load_keys ⇒ Object
- #master_key_names ⇒ Object
- #reload_master_keys ⇒ Object
- #reset_master_keys ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 10 11 |
# File 'lib/portunus/configuration.rb', line 5 def initialize @storage_adaptor = ::Portunus::StorageAdaptors::Credentials @encrypter = ::Portunus::Encrypters::OpenSslAes @keys_loaded = false @master_key_names = [] @max_key_duration = 6.months end |
Instance Attribute Details
#encrypter ⇒ Object
Returns the value of attribute encrypter.
3 4 5 |
# File 'lib/portunus/configuration.rb', line 3 def encrypter @encrypter end |
#max_key_duration ⇒ Object
Returns the value of attribute max_key_duration.
3 4 5 |
# File 'lib/portunus/configuration.rb', line 3 def max_key_duration @max_key_duration end |
#storage_adaptor ⇒ Object
Returns the value of attribute storage_adaptor.
3 4 5 |
# File 'lib/portunus/configuration.rb', line 3 def storage_adaptor @storage_adaptor end |
Instance Method Details
#add_key(key_name) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/portunus/configuration.rb', line 18 def add_key(key_name) @master_key_names.push(key_name) # we want to load all the names of the keys in the storage # adaptor. Because we might need to search through an environment # that has quite a few keys often for every key we want to load # the valid keys end |
#keys_loaded? ⇒ Boolean
26 27 28 |
# File 'lib/portunus/configuration.rb', line 26 def keys_loaded? @keys_loaded end |
#load_keys ⇒ Object
13 14 15 16 |
# File 'lib/portunus/configuration.rb', line 13 def load_keys storage_adaptor.load @keys_loaded = true end |
#master_key_names ⇒ Object
43 44 45 46 47 |
# File 'lib/portunus/configuration.rb', line 43 def master_key_names load_keys unless keys_loaded? @master_key_names end |
#reload_master_keys ⇒ Object
36 37 38 39 40 41 |
# File 'lib/portunus/configuration.rb', line 36 def reload_master_keys # Perform a reload on the master keys. This is used in tests and to # add new keys into the environment without rebooting the app. @master_key_names = [] load_keys end |
#reset_master_keys ⇒ Object
30 31 32 33 34 |
# File 'lib/portunus/configuration.rb', line 30 def reset_master_keys # Clear all master keys to empty, used for testing @master_key_names = [] @keys_loaded = false end |