diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb
index 34880ce58..4257861c3 100644
--- a/lib/redmine/configuration.rb
+++ b/lib/redmine/configuration.rb
@@ -5,42 +5,42 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module Redmine
module Configuration
-
+
# Configuration default values
@defaults = {
'email_delivery' => nil
}
-
+
@config = nil
-
+
class << self
# Loads the Redmine configuration file
# Valid options:
# * :file: the configuration file to load (default: config/configuration.yml)
- # * :env: the environment to load the configuration for (default: Rails.env)
+ # * :env: the environment to load the configuration for (default: Rails.env)
def load(options={})
filename = options[:file] || File.join(Rails.root, 'config', 'configuration.yml')
env = options[:env] || Rails.env
-
+
@config = @defaults.dup
-
+
load_deprecated_email_configuration(env)
if File.file?(filename)
@config.merge!(load_from_yaml(filename, env))
end
-
+
# Compatibility mode for those who copy email.yml over configuration.yml
%w(delivery_method smtp_settings sendmail_settings).each do |key|
if value = @config.delete(key)
@@ -48,7 +48,7 @@ module Redmine
@config['email_delivery'][key] = value
end
end
-
+
if @config['email_delivery']
ActionMailer::Base.perform_deliveries = true
@config['email_delivery'].each do |k, v|
@@ -56,16 +56,16 @@ module Redmine
ActionMailer::Base.send("#{k}=", v)
end
end
-
+
@config
end
-
+
# Returns a configuration setting
def [](name)
load unless @config
@config[name]
end
-
+
# Yields a block with the specified hash configuration settings
def with(settings)
settings.stringify_keys!
@@ -75,9 +75,9 @@ module Redmine
yield if block_given?
@config.merge! was
end
-
+
private
-
+
def load_from_yaml(filename, env)
yaml = YAML::load_file(filename)
conf = {}
@@ -94,7 +94,7 @@ module Redmine
end
conf
end
-
+
def load_deprecated_email_configuration(env)
deprecated_email_conf = File.join(Rails.root, 'config', 'email.yml')
if File.file?(deprecated_email_conf)