module Sinatra::ConfigFile
def config_file(*paths)
arguments, filtering the settings for the current environment. Note that
Loads the configuration from the YAML files whose +paths+ are passed as
def config_file(*paths) Dir.chdir(root || '.') do paths.each do |pattern| Dir.glob(pattern) do |file| raise UnsupportedConfigType unless ['.yml', '.yaml', '.erb'].include?(File.extname(file)) logger.info "loading config file '#{file}'" if logging? && respond_to?(:logger) document = ERB.new(File.read(file)).result yaml = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(document) : YAML.load(document) config = config_for_env(yaml) config.each_pair { |key, value| set(key, value) } end end end end