class Veil::CredentialCollection::ChefSecretsEnv

Public Class Methods

new(opts = {}) click to toggle source

Create a new ChefSecretsEnv

@param [Hash] opts

a hash of options to pass to the constructor
# File lib/veil/credential_collection/chef_secrets_env.rb, line 12
def initialize(opts = {})
  var_name = opts[:var_name] || 'CHEF_SECRETS_DATA'

  @credentials = {}
  import_credentials_hash(inflate_secrets_from_environment(var_name))
end

Public Instance Methods

inflate_secrets_from_environment(var_name) click to toggle source
# File lib/veil/credential_collection/chef_secrets_env.rb, line 26
def inflate_secrets_from_environment(var_name)
  value = ENV[var_name]
  unless value
    msg = "Env var #{var_name} has not been set. This should by done by "\
      "launching this application via veil-env-wrapper."
    raise InvalidCredentialCollectionEnv.new(msg)
  end

  begin
    JSON.parse(value)
  rescue JSON::ParserError => e
    msg = "Env var #{var_name} could not be parsed: #{e.message}"
    raise InvalidCredentialCollectionEnv.new(msg)
  end
end
rotate() click to toggle source

Unsupported methods

# File lib/veil/credential_collection/chef_secrets_env.rb, line 20
def rotate
  raise NotImplementedError
end
Also aliased as: rotate_credentials, save
rotate_credentials()
Alias for: rotate
save()
Alias for: rotate