def config_for(name, env: Rails.env)
      if name.is_a?(Pathname)
        yaml = name
      else
        yaml = Pathname.new("#{paths["config"].existent.first}/#{name}.yml")
      end

      if yaml.exist?
        require "erb"
        config = YAML.load(ERB.new(yaml.read).result) || {}
        config = (config["shared"] || {}).merge(config[env] || {})

        ActiveSupport::OrderedOptions.new.tap do |options|
          options.update(NonSymbolAccessDeprecatedHash.new(config))
        end
      else
        raise "Could not load configuration. No such file - #{yaml}"
      end
    rescue Psych::SyntaxError => e
      raise "YAML syntax error occurred while parsing #{yaml}. " \
        "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
        "Error: #{e.message}"
    end
def config_for(name, env: Rails.env)
      if name.is_a?(Pathname)
        yaml = name
      else
        yaml = Pathname.new("#{paths["config"].existent.first}/#{name}.yml")
      end

      if yaml.exist?
        require "erb"
        config = YAML.load(ERB.new(yaml.read).result) || {}
        config = (config["shared"] || {}).merge(config[env] || {})

        ActiveSupport::OrderedOptions.new.tap do |options|
          options.update(NonSymbolAccessDeprecatedHash.new(config))
        end
      else
        raise "Could not load configuration. No such file - #{yaml}"
      end
    rescue Psych::SyntaxError => e
      raise "YAML syntax error occurred while parsing #{yaml}. " \
        "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
        "Error: #{e.message}"
    end
Convenience for loading config/foo.yml for the current Rails env.

 Example:

     # config/exception_notification.yml:
     production:
       url: http://127.0.0.1:8080
       namespace: my_app_production
     development:
       url: http://localhost:3001
       namespace: my_app_development

     # config/environments/production.rb
     Rails.application.configure do
       config.middleware.use ExceptionNotifier, config_for(:exception_notification)
     end