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



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

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



23
24
25
26
27
28
29
30
# File 'lib/openc3/utilities/redis_secrets.rb', line 23

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



19
20
21
# File 'lib/openc3/utilities/redis_secrets.rb', line 19

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

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



32
33
34
# File 'lib/openc3/utilities/redis_secrets.rb', line 32

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