module Sinatra::ConfigFile

def config_for_env(hash)

precedence to environment settings defined at the root-level.
settings applicable to the current environment. Note: It gives
Given a +hash+ containing application configuration it returns
def config_for_env(hash)
  return from_environment_key(hash) if environment_keys?(hash)
  hash.each_with_object(IndifferentHash[]) do |(k, v), acc|
    if environment_keys?(v)
      acc.merge!(k => v[environment.to_s]) if v.key?(environment.to_s)
    else
      acc.merge!(k => v)
    end
  end
end