Sha256: 0b4aedc69de9a92492224562f4245947fcffc10d675c7b9a8cb1ea3e3587185d
Contents?: true
Size: 879 Bytes
Versions: 2
Compression:
Stored size: 879 Bytes
Contents
module Terraformer module Credentials class DatadogMissingCredentals < RuntimeError attr_reader :key def initialize(key) @key = key super(message) end def message "'#{key}' not being passed. set it via CLI --#{key} or #{key.upcase} enviroment variable." end end class Datadog KEYS = %w(datadog_api_key datadog_app_key).freeze def self.get_from_options(options) KEYS.inject({}) do |credentials, key| datadog_key = key.sub("datadog_", "").to_sym credentials[datadog_key] = options[key.to_sym].nil? ? options[key] : options[key.to_sym] credentials[datadog_key] = ENV[key.upcase] if credentials[datadog_key].nil? raise DatadogMissingCredentals.new(key) if credentials[datadog_key].nil? credentials end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
terraform-exporter-0.0.4 | lib/terraformer/credentials/datadog.rb |
terraform-exporter-0.0.3 | lib/terraformer/credentials/datadog.rb |