Class: OpenC3::RedisSecrets

Inherits:
Secrets show all
Defined in:
lib/openc3/utilities/redis_secrets.rb

Instance Method Summary collapse

Methods inherited from Secrets

getClient, #initialize, #setup

Constructor Details

This class inherits a constructor from OpenC3::Secrets

Instance Method Details

#delete(key, secret_store: nil, scope:) ⇒ Object



41
42
43
44
# File 'lib/openc3/utilities/redis_secrets.rb', line 41

def delete(key, secret_store: nil, scope:)
  model = SecretModel.get_model(name: key, scope: scope)
  model.destroy if model
end

#get(key, secret_store: nil, scope:) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/openc3/utilities/redis_secrets.rb', line 28

def get(key, secret_store: nil, scope:)
  data = SecretModel.get(name: key, scope: scope)
  if data
    return data['value']
  else
    return nil
  end
end

#keys(secret_store: nil, scope:) ⇒ Object



24
25
26
# File 'lib/openc3/utilities/redis_secrets.rb', line 24

def keys(secret_store: nil, scope:)
  SecretModel.names(scope: scope)
end

#set(key, value, secret_store: nil, scope:) ⇒ Object



37
38
39
# File 'lib/openc3/utilities/redis_secrets.rb', line 37

def set(key, value, secret_store: nil, scope:)
  SecretModel.set( {name: key, value: value.to_s }, scope: scope)
end