##// END OF EJS Templates
Adds a form to manually submit an email to the mail handler....
Adds a form to manually submit an email to the mail handler. Use GET /mail_handler?key= to get the form. git-svn-id: http://svn.redmine.org/redmine/trunk@14314 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r13490:000124f44f53
r13932:95f7471e9c78
Show More
configuration.rb
128 lines | 4.4 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r13490 # Copyright (C) 2006-2015 Jean-Philippe Lang
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 #
# This program is free software; you can redistribute it and/or
# 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.
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823 #
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 # 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.
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823 #
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 # 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
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 # Configuration default values
@defaults = {
Jean-Philippe Lang
Merged ajax_upload branch (#3957)....
r10748 'email_delivery' => nil,
'max_concurrent_ajax_uploads' => 2
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 }
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 @config = nil
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 class << self
# Loads the Redmine configuration file
# Valid options:
# * <tt>:file</tt>: the configuration file to load (default: config/configuration.yml)
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823 # * <tt>:env</tt>: the environment to load the configuration for (default: Rails.env)
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 def load(options={})
filename = options[:file] || File.join(Rails.root, 'config', 'configuration.yml')
env = options[:env] || Rails.env
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 @config = @defaults.dup
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 load_deprecated_email_configuration(env)
if File.file?(filename)
@config.merge!(load_from_yaml(filename, env))
end
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 # 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)
@config['email_delivery'] ||= {}
@config['email_delivery'][key] = value
end
end
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 if @config['email_delivery']
ActionMailer::Base.perform_deliveries = true
@config['email_delivery'].each do |k, v|
v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
ActionMailer::Base.send("#{k}=", v)
end
end
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds configuration settings to limit valid repository path (#1415)....
r13191 check_regular_expressions
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 @config
end
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 # Returns a configuration setting
def [](name)
load unless @config
@config[name]
end
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds a method to temporarily override configuration settings....
r4829 # Yields a block with the specified hash configuration settings
def with(settings)
settings.stringify_keys!
load unless @config
was = settings.keys.inject({}) {|h,v| h[v] = @config[v]; h}
@config.merge! settings
yield if block_given?
@config.merge! was
end
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 private
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 def load_from_yaml(filename, env)
Jean-Philippe Lang
Adds an explicit error message for invalid YAML configuration file (#9748)....
r7992 yaml = nil
begin
Jean-Philippe Lang
Parse configuration file for ERB (#16878)....
r12875 yaml = YAML::load(ERB.new(File.read(filename)).result)
Jean-Philippe Lang
Adds an explicit error message for invalid YAML configuration file (#9748)....
r7992 rescue ArgumentError
Jean-Philippe Lang
Code cleanup....
r13196 abort "Your Redmine configuration file located at #{filename} is not a valid YAML file and could not be loaded."
Jean-Philippe Lang
Adds a custom message for when a syntax error occurs (#16878)....
r12876 rescue SyntaxError => e
Jean-Philippe Lang
Code cleanup....
r13196 abort "A syntax error occurred when parsing your Redmine configuration file located at #{filename} with ERB:\n#{e.message}"
Jean-Philippe Lang
Adds an explicit error message for invalid YAML configuration file (#9748)....
r7992 end
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 conf = {}
if yaml.is_a?(Hash)
if yaml['default']
conf.merge!(yaml['default'])
end
if yaml[env]
conf.merge!(yaml[env])
end
else
Jean-Philippe Lang
Code cleanup....
r13196 abort "Your Redmine configuration file located at #{filename} is not a valid Redmine configuration file."
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 end
conf
end
Toshi MARUYAMA
remove trailing white-spaces from lib/redmine/configuration.rb....
r6823
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 def load_deprecated_email_configuration(env)
deprecated_email_conf = File.join(Rails.root, 'config', 'email.yml')
if File.file?(deprecated_email_conf)
warn "Storing outgoing emails configuration in config/email.yml is deprecated. You should now store it in config/configuration.yml using the email_delivery setting."
@config.merge!({'email_delivery' => load_from_yaml(deprecated_email_conf, env)})
end
end
Jean-Philippe Lang
Adds configuration settings to limit valid repository path (#1415)....
r13191
# Checks the validness of regular expressions set for repository paths at startup
def check_regular_expressions
@config.each do |name, value|
if value.present? && name =~ /^scm_.+_path_regexp$/
begin
Regexp.new value.to_s.strip
rescue => e
Jean-Philippe Lang
Code cleanup....
r13196 abort "Invalid regular expression set as #{name} setting in your Redmine configuration file:\n#{e.message}"
Jean-Philippe Lang
Adds configuration settings to limit valid repository path (#1415)....
r13191 end
end
end
end
Jean-Philippe Lang
Adds an application configuration file: config/configuration.yml (#7408)....
r4632 end
end
end