diff options
author | Robert Speicher <robert@gitlab.com> | 2015-10-14 20:38:36 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2015-10-14 20:38:36 +0000 |
commit | 976400c1e6c653ce93cd29d32a007c091a38f970 (patch) | |
tree | 9494886337b23bbc44a6350307bfff7ebe48dde1 /lib | |
parent | 123669a55107514798ba531ba3a744b3ec8503ee (diff) | |
parent | 459b882131f5da02e86e89abde6c84dfee2d587c (diff) | |
download | gitlab-ce-976400c1e6c653ce93cd29d32a007c091a38f970.tar.gz |
Merge branch 'incoming-email-config' into 'master'
Make Reply by email easier to configure
Builds on !1566.
Omnibus companion MR: gitlab-org/omnibus-gitlab!510 (cc @marin)
See merge request !1580
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/incoming_email.rb | 4 | ||||
-rw-r--r-- | lib/tasks/gitlab/check.rake | 37 |
2 files changed, 7 insertions, 34 deletions
diff --git a/lib/gitlab/incoming_email.rb b/lib/gitlab/incoming_email.rb index 856ccc71084..9068d79c95e 100644 --- a/lib/gitlab/incoming_email.rb +++ b/lib/gitlab/incoming_email.rb @@ -24,12 +24,12 @@ module Gitlab match[1] end - private - def config Gitlab.config.incoming_email end + private + def address_regex wildcard_address = config.address return nil unless wildcard_address diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 66f1ecf385f..606bf241db7 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -642,7 +642,6 @@ namespace :gitlab do if Gitlab.config.incoming_email.enabled check_address_formatted_correctly - check_mail_room_config_exists check_imap_authentication if Rails.env.production? @@ -744,42 +743,16 @@ namespace :gitlab do end end - def check_mail_room_config_exists - print "MailRoom config exists? ... " - - mail_room_config_file = Rails.root.join("config", "mail_room.yml") - - if File.exists?(mail_room_config_file) - puts "yes".green - else - puts "no".red - try_fixing_it( - "Copy config/mail_room.yml.example to config/mail_room.yml", - "Check that the information in config/mail_room.yml is correct" - ) - for_more_information( - "doc/incoming_email/README.md" - ) - fix_and_rerun - end - end - def check_imap_authentication print "IMAP server credentials are correct? ... " - mail_room_config_file = Rails.root.join("config", "mail_room.yml") - - unless File.exists?(mail_room_config_file) - puts "can't check because of previous errors".magenta - return - end - - config = YAML.load_file(mail_room_config_file)[:mailboxes].first rescue nil + config = Gitlab.config.incoming_email if config begin - imap = Net::IMAP.new(config[:host], port: config[:port], ssl: config[:ssl]) - imap.login(config[:email], config[:password]) + imap = Net::IMAP.new(config.host, port: config.port, ssl: config.ssl) + imap.starttls if config.start_tls + imap.login(config.user, config.password) connected = true rescue connected = false @@ -791,7 +764,7 @@ namespace :gitlab do else puts "no".red try_fixing_it( - "Check that the information in config/mail_room.yml is correct" + "Check that the information in config/gitlab.yml is correct" ) for_more_information( "doc/incoming_email/README.md" |