Revision c6fcfc9c
Added by Eric Helms almost 9 years ago
Gemfile | ||
---|---|---|
# foreman plugins import this file therefore __FILE__ cannot be used
|
||
FOREMAN_GEMFILE = __FILE__ unless defined? FOREMAN_GEMFILE
|
||
require File.expand_path('../config/settings', FOREMAN_GEMFILE)
|
||
require File.expand_path('../lib/regexp_extensions', FOREMAN_GEMFILE)
|
||
|
||
source 'https://rubygems.org'
|
bundler.d/jsonp.rb | ||
---|---|---|
group :jsonp do
|
||
gem 'rack-jsonp', :require => 'rack/jsonp'
|
||
end if SETTINGS[:support_jsonp]
|
||
end
|
config/application.rb | ||
---|---|---|
|
||
require 'rails/all'
|
||
|
||
require File.expand_path('../../config/settings', __FILE__)
|
||
|
||
if File.exist?(File.expand_path('../../Gemfile.in', __FILE__))
|
||
# If there is a Gemfile.in file, we will not use Bundler but BundlerExt
|
||
# gem which parses this file and loads all dependencies from the system
|
config/boot.rb | ||
---|---|---|
require 'rubygems'
|
||
require 'yaml'
|
||
require File.expand_path('../../config/settings', __FILE__)
|
||
|
||
unless File.exist?(File.expand_path('../../Gemfile.in', __FILE__))
|
||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
config/settings.rb | ||
---|---|---|
require 'yaml'
|
||
require "#{root}/app/services/foreman/version"
|
||
|
||
SETTINGS = YAML.load_file("#{root}/config/settings.yaml")
|
||
settings_file = Rails.env.test? ? 'config/settings.yaml.test' : 'config/settings.yaml'
|
||
|
||
SETTINGS = YAML.load_file("#{root}/#{settings_file}")
|
||
SETTINGS[:version] = Foreman::Version.new
|
||
SETTINGS[:unattended] = SETTINGS[:unattended].nil? || SETTINGS[:unattended]
|
||
SETTINGS[:login] ||= SETTINGS[:ldap]
|
config/settings.yaml.test | ||
---|---|---|
---
|
||
:unattended: true
|
||
:login: true
|
||
:require_ssl: false
|
||
:locations_enabled: true
|
||
:organizations_enabled: true
|
Also available in: Unified diff
Fixes #11056: Configure base SETTINGS for test environment.
This change introduces the idea of having a base configuration for
SETTINGS within the test environment. This is captured in the
settings.yaml.test file. To be able to detect the Rails environment
in settings.rb, the ordering had to be changed whereby the Gemfile
is loaded up via boot.rb and then Rails is required so that the
Rails environment is available by the time settings.rb is processed.