lib/cratus/config.rb
def load
      # First, apply the defaults
      merge defaults

      # Then apply the config file, if one exists
      begin
        apprc_dir = File.expand_path('~')
        config_file = File.expand_path(File.join(apprc_dir, '.cratus.yml'))
        merge YAML.load_file(config_file) if File.readable?(config_file)
      rescue => e
        puts "WARNING: Unable to read from #{config_file}: #{e.message}"
      end

      # Finally, apply any environment variables specified
      env_conf = {}
      defaults.keys.each do |key|
        cratus_key = "CRATUS_#{key}".upcase
        env_conf[key] = ENV[cratus_key] if ENV.key?(cratus_key)
      end
      merge env_conf unless env_conf.empty?
    end
def load
      # First, apply the defaults
      merge defaults

      # Then apply the config file, if one exists
      begin
        apprc_dir = File.expand_path('~')
        config_file = File.expand_path(File.join(apprc_dir, '.cratus.yml'))
        merge YAML.load_file(config_file) if File.readable?(config_file)
      rescue => e
        puts "WARNING: Unable to read from #{config_file}: #{e.message}"
      end

      # Finally, apply any environment variables specified
      env_conf = {}
      defaults.keys.each do |key|
        cratus_key = "CRATUS_#{key}".upcase
        env_conf[key] = ENV[cratus_key] if ENV.key?(cratus_key)
      end
      merge env_conf unless env_conf.empty?
    end
Construct a base config using the following order of precedence:
   * environment variables
   * YAML file
   * defaults