2 # If secret_token.rb exists here, we need to load it first.
3 require_relative 'secret_token.rb'
5 # Normally secret_token.rb is missing and the secret token is
6 # configured by application.yml (i.e., here!) instead.
9 $application_config = {}
11 %w(application.default application).each do |cfgfile|
12 path = "#{::Rails.root.to_s}/config/#{cfgfile}.yml"
14 yaml = ERB.new(IO.read path).result(binding)
15 confs = YAML.load(yaml)
16 # Ignore empty YAML file:
17 next if confs == false
18 $application_config.merge!(confs['common'] || {})
19 $application_config.merge!(confs[::Rails.env.to_s] || {})
23 Server::Application.configure do
25 $application_config.each do |k, v|
26 # "foo.bar: baz" --> { config.foo.bar = baz }
33 if cfg.respond_to?(k.to_sym) and !cfg.send(k).nil?
34 # Config must have been set already in environments/*.rb.
36 # After config files have been migrated, this mechanism should
37 # be deprecated, then removed.
39 # Config variables are not allowed to be nil. Make a "naughty"
40 # list, and present it below.
48 Refusing to start in #{::Rails.env.to_s} mode with missing configuration.
50 The following configuration settings must be specified in
51 config/application.yml: