Class: SecureKeys::Core::Environment::CI

Inherits:
Object
  • Object
show all
Defined in:
lib/core/environment/ci.rb

Instance Method Summary collapse

Instance Method Details

#fetch(key:) ⇒ String

Fetches the value of the environment variable with the given key.

Parameters:

  • key (String)

    the key of the environment variable to fetch

Returns:

  • (String)

    the value of the environment variable



12
13
14
15
16
17
18
19
20
21
# File 'lib/core/environment/ci.rb', line 12

def fetch(key:)
  normalized_key = key.to_s.tr('-', '_').upcase

  ENV[key.to_s] ||
    ENV[normalized_key] ||
    ENV["SECURE_KEYS_#{normalized_key}"] ||
    inline_identifier_value(key)
rescue StandardError
  Core::Console::Logger.error(message: "Error fetching the key '#{key}' from ENV variables")
end