require 'json' require 'mixlib/config' require 'threat_agent/exceptions' require 'yaml' module ThreatAgent # A class that load's the user's configuration # # @author Erran Carey class Config extend Mixlib::Config include ThreatAgent::Exceptions # Sets the default configuration options configure do |config| config[:endpoint] = ENV['THREAT_AGENT_ENDPOINT'] || 'https://www.threatagent.com' config[:key] = ENV['THREAT_AGENT_KEY'] config[:sup] = ENV['THREAT_AGENT_SUP'] config[:api_version] = 'v1' end # TODO: Add from_json/from_yaml methods to Mixlib::Config or add them here =begin def self.from_json(file) hash = File.exists? ? JSON.parse(file) : {} end def self.from_yaml(file) hash = File.exists? ? YAML.parse(file).to_ruby : {} end =end end end