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 if (File.exists?(File.expand_path '../omniauth.rb', __FILE__) and
10 not defined? WARNED_OMNIAUTH_CONFIG)
11 Rails.logger.warn <<-EOS
12 DEPRECATED CONFIGURATION:
13 Please move your SSO provider config into config/application.yml
14 and delete config/initializers/omniauth.rb.
16 # Real values will be copied from globals by omniauth_init.rb. For
17 # now, assign some strings so the generic *.yml config loader
18 # doesn't overwrite them or complain that they're missing.
19 Rails.configuration.sso_app_id = 'xxx'
20 Rails.configuration.sso_app_secret = 'xxx'
21 Rails.configuration.sso_provider_url = '//xxx'
22 WARNED_OMNIAUTH_CONFIG = true
25 $application_config = {}
27 %w(application.default application).each do |cfgfile|
28 path = "#{::Rails.root.to_s}/config/#{cfgfile}.yml"
30 yaml = ERB.new(IO.read path).result(binding)
31 confs = YAML.load(yaml)
32 # Ignore empty YAML file:
33 next if confs == false
34 $application_config.merge!(confs['common'] || {})
35 $application_config.merge!(confs[::Rails.env.to_s] || {})
39 Server::Application.configure do
41 $application_config.each do |k, v|
42 # "foo.bar: baz" --> { config.foo.bar = baz }
49 if cfg.respond_to?(k.to_sym) and !cfg.send(k).nil?
50 # Config must have been set already in environments/*.rb.
52 # After config files have been migrated, this mechanism should
53 # be deprecated, then removed.
55 # Config variables are not allowed to be nil. Make a "naughty"
56 # list, and present it below.
64 Refusing to start in #{::Rails.env.to_s} mode with missing configuration.
66 The following configuration settings must be specified in
67 config/application.yml: