summaryrefslogtreecommitdiff
path: root/lib/system_check/incoming_email/foreman_configured_check.rb
blob: fa0e711fb0912e9838c79343d0a0caacc069989e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module SystemCheck
  module IncomingEmail
    class ForemanConfiguredCheck < SystemCheck::BaseCheck
      set_name _('Foreman configured correctly?')

      def check?
        path = Rails.root.join('Procfile')

        File.exist?(path) && File.read(path) =~ /^mail_room:/
      end

      def show_error
        try_fixing_it(
          _('Enable mail_room in your Procfile.')
        )
        for_more_information(
          'doc/administration/reply_by_email.md'
        )
        fix_and_rerun
      end
    end
  end
end