Method: ConfigFor::Sinatra#config_for

Defined in:
lib/config_for/sinatra.rb

#config_for(name) ⇒ ActiveSupport::HashWithIndifferentAccess

Convenience loading of config files.

Examples:

class MyApp < Sinatra::Base
  register ConfigFor::Sinatra

  set :redis, Redis.new(config_for(:redis))
end

Parameters:

  • name (String, Symbol)

    the config file to load

Returns:

  • (ActiveSupport::HashWithIndifferentAccess)

    loaded config file for current environment

Raises:


21
22
23
# File 'lib/config_for/sinatra.rb', line 21

def config_for(name)
  ConfigFor.load_config!(settings.config_path, name, settings.environment)
end