I can't really agree on the exceptionality of not including a config file, my preference in most cases would be to WARN as most gems for third party services do (e.g. NewRelic doesn't prevent my server from starting up if it is missing it's configuration). I also want to make sure I understand this, we want to prevent the server from starting if the file isn't there and we want this to be the only option outside of manually checking for it's existence?
In the end what I'm suggesting is that this developers should not be limited in how they can handle a missing config. Providing a helper would some kind of solution, but I don't see why it would be preferred over an idiomatic solution similar to Hash#fetch. I would further suggest that it suffers from the same problem of a typo issue, as well as being less "DRY" since you have to repeat the name of the file. For example:
if has_config_for? :rdis do
config.x.redis = config_for(:redis)
else
config.logger.warn("Redis config is missing")
end
This is now misleading as it isn't redis.yml that is missing, but rdis.yml.
The block approach having a couple of benefits over just checking existance.
1) If a block or value is not provided as the second argument it can basically keep the exact same logic (raising an exception) as before. No change to any existing usages.
2) It can be made DRYer since we only reference the config file name once and we could pass the name into the block if we want to allowing for a generic helper that does something like logging a missing file warning or error.
# /config/initializers/redis.rb
redis_config = Rails.application.config_for(:redis) do |config_name|
config.logger.warn("Configuration for #{config_name} not found!")
false
end
return unless redis_config
3) It feels more idiomatic to me as this is how Hash#fetch already works
4) An existence checking helper still feels like basically just another form of nil checking in the end