diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-11-28 03:08:31 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2018-12-04 00:51:46 +0300 |
commit | 6855e6b5864abcf01689720424a4bea4c3b9fec2 (patch) | |
tree | 627226eee254d76b41d16cfd99f07be3f7c3f6b5 /lib/system_check/incoming_email_check.rb | |
parent | c3c25174e3397ca3f301b539477e6568c676d264 (diff) |
Extract system check rake task logic
These changes make the code more reusable, testable, and most
importantly, overrideable.
Diffstat (limited to 'lib/system_check/incoming_email_check.rb')
-rw-r--r-- | lib/system_check/incoming_email_check.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/system_check/incoming_email_check.rb b/lib/system_check/incoming_email_check.rb new file mode 100644 index 00000000000..155b6547595 --- /dev/null +++ b/lib/system_check/incoming_email_check.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module SystemCheck + # Used by gitlab:incoming_email:check rake task + class IncomingEmailCheck < BaseCheck + set_name 'Incoming Email:' + + def multi_check + if Gitlab.config.incoming_email.enabled + checks = [ + SystemCheck::IncomingEmail::ImapAuthenticationCheck + ] + + if Rails.env.production? + checks << SystemCheck::IncomingEmail::InitdConfiguredCheck + checks << SystemCheck::IncomingEmail::MailRoomRunningCheck + else + checks << SystemCheck::IncomingEmail::ForemanConfiguredCheck + end + + SystemCheck.run('Reply by email', checks) + else + $stdout.puts 'Reply by email is disabled in config/gitlab.yml' + end + end + end +end |