class ActiveRecord::DatabaseConfigurations

def build_configs(configs)

def build_configs(configs)
  return configs.configurations if configs.is_a?(DatabaseConfigurations)
  return configs if configs.is_a?(Array)
  db_configs = configs.flat_map do |env_name, config|
    if config.is_a?(Hash) && config.values.all?(Hash)
      walk_configs(env_name.to_s, config)
    else
      build_db_config_from_raw_config(env_name.to_s, "primary", config)
    end
  end
  unless db_configs.find(&:for_current_env?)
    db_configs << environment_url_config(default_env, "primary", {})
  end
  merge_db_environment_variables(default_env, db_configs.compact)
end