Module: LogStash::Util::SecretStore
- Defined in:
- lib/logstash/util/secretstore.rb
Overview
Ruby helper to work with the secret store
Constant Summary collapse
- SECRET_STORE_FACTORY =
SecretStoreFactory::fromEnvironment()
Class Method Summary collapse
-
.exists? ⇒ Boolean
Check to see if the secret store exists, return true if exists, false otherwise.
-
.get_config ⇒ Object
Return the configuration necessary to work with a secret store.
-
.get_if_exists ⇒ Object
Returns a org.logstash.secret.store.SecretStore if it exists, nil otherwise.
-
.get_store_id(id) ⇒ Object
Returns a org.org.logstash.secret.SecretIdentifier for use with the secret store.
Class Method Details
.exists? ⇒ Boolean
Check to see if the secret store exists, return true if exists, false otherwise
24 25 26 |
# File 'lib/logstash/util/secretstore.rb', line 24 def self.exists? SECRET_STORE_FACTORY.exists(get_config) end |
.get_config ⇒ Object
Return the configuration necessary to work with a secret store
14 15 16 17 18 19 20 21 |
# File 'lib/logstash/util/secretstore.rb', line 14 def self.get_config secure_config = SecureConfig.new secure_config.add("keystore.file", LogStash::SETTINGS.get_setting("keystore.file").value.chars) pass = ENV["LOGSTASH_KEYSTORE_PASS"] secure_config.add("keystore.pass", pass.chars) unless pass.nil? secure_config.add("keystore.classname", LogStash::SETTINGS.get_setting("keystore.classname").value.chars) secure_config end |
.get_if_exists ⇒ Object
Returns a org.logstash.secret.store.SecretStore if it exists, nil otherwise
29 30 31 |
# File 'lib/logstash/util/secretstore.rb', line 29 def self.get_if_exists SECRET_STORE_FACTORY.load(get_config) if exists? end |
.get_store_id(id) ⇒ Object
Returns a org.org.logstash.secret.SecretIdentifier for use with the secret store
34 35 36 |
# File 'lib/logstash/util/secretstore.rb', line 34 def self.get_store_id(id) SecretIdentifier.new(id) end |