1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
6 # If secret_token.rb exists here, we need to load it first.
7 require_relative 'secret_token.rb'
9 # Normally secret_token.rb is missing and the secret token is
10 # configured by application.yml (i.e., here!) instead.
13 if (File.exist?(File.expand_path '../omniauth.rb', __FILE__) and
14 not defined? WARNED_OMNIAUTH_CONFIG)
15 Rails.logger.warn <<-EOS
16 DEPRECATED CONFIGURATION:
17 Please move your SSO provider config into config/application.yml
18 and delete config/initializers/omniauth.rb.
20 # Real values will be copied from globals by omniauth_init.rb. For
21 # now, assign some strings so the generic *.yml config loader
22 # doesn't overwrite them or complain that they're missing.
23 Rails.configuration.sso_app_id = 'xxx'
24 Rails.configuration.sso_app_secret = 'xxx'
25 Rails.configuration.sso_provider_url = '//xxx'
26 WARNED_OMNIAUTH_CONFIG = true
29 $application_config = {}
31 %w(application.default application).each do |cfgfile|
32 path = "#{::Rails.root.to_s}/config/#{cfgfile}.yml"
34 yaml = ERB.new(IO.read path).result(binding)
35 confs = YAML.load(yaml, deserialize_symbols: true)
36 # Ignore empty YAML file:
37 next if confs == false
38 $application_config.merge!(confs['common'] || {})
39 $application_config.merge!(confs[::Rails.env.to_s] || {})
43 Server::Application.configure do
45 $application_config.each do |k, v|
46 # "foo.bar: baz" --> { config.foo.bar = baz }
53 if cfg.respond_to?(k.to_sym) and !cfg.send(k).nil?
54 # Config must have been set already in environments/*.rb.
56 # After config files have been migrated, this mechanism should
57 # be deprecated, then removed.
59 # Config variables are not allowed to be nil. Make a "naughty"
60 # list, and present it below.
68 Refusing to start in #{::Rails.env.to_s} mode with missing configuration.
70 The following configuration settings must be specified in
71 config/application.yml:
76 config.secret_key_base = config.secret_token