summaryrefslogtreecommitdiff
path: root/config/mail_room.yml
blob: b453ed8ce35c73274882f7a418106f8c82e83702 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
:mailboxes:
  <%
    require_relative "../lib/gitlab/mail_room" unless defined?(Gitlab::MailRoom)
    Gitlab::MailRoom.enabled_configs.each do |key, config|
  %>
    -
      :host: <%= config[:host].to_json %>
      :port: <%= config[:port].to_json %>
      :ssl: <%= config[:ssl].to_json %>
      :start_tls: <%= config[:start_tls].to_json %>
      :email: <%= config[:user].to_json %>
      :password: <%= config[:password].to_json %>
      :idle_timeout: <%= config[:idle_timeout].to_json %>
      :logger:
        :log_path: <%= config[:log_path].to_json %>

      :name: <%= config[:mailbox].to_json %>

      :delete_after_delivery: <%= config.fetch(:delete_after_delivery, true).to_json %>
      :expunge_deleted: <%= config[:expunge_deleted].to_json %>

      <% if config[:inbox_method] %>
      :inbox_method: <%= config[:inbox_method] %>
      <% end %>
      <% if config[:inbox_options].is_a?(Hash) %>
      <%= config.slice(:inbox_options).to_yaml(indentation: 8).gsub(/^---\n/, '') %>
      <% end %>

      <% if config[:delivery_method] == Gitlab::MailRoom::DELIVERY_METHOD_SIDEKIQ %>
      :delivery_method: sidekiq
      :delivery_options:
        :redis_url: <%= config[:redis_url].to_json %>
        :redis_db: <%= config[:redis_db] %>
        :namespace: <%= Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE %>
        :queue: <%= config[:queue] %>
        :worker: <%= config[:worker] %>
        <% if config[:sentinels] %>
        :sentinels:
          <% config[:sentinels].each do |sentinel| %>
          -
            :host: <%= sentinel[:host] %>
            :port: <%= sentinel[:port] %>
          <% end %>
        <% end %>
      <% elsif config[:delivery_method] == Gitlab::MailRoom::DELIVERY_METHOD_WEBHOOK %>
      :delivery_method: postback
      :delivery_options:
        :delivery_url: <%= config[:gitlab_url] %>/api/v4/internal/mail_room/<%= key %>
        :content_type: text/plain
        :jwt_auth_header: <%= Gitlab::MailRoom::INTERNAL_API_REQUEST_HEADER %>
        :jwt_issuer: <%= Gitlab::MailRoom::INTERNAL_API_REQUEST_JWT_ISSUER %>
        :jwt_algorithm: "HS256"
        :jwt_secret_path: <%= config[:secret_file] %>
      <% end %>

      :arbitration_method: redis
      :arbitration_options:
        :redis_url: <%= config[:redis_url].to_json %>
        :namespace: <%= Gitlab::Redis::Queues::MAILROOM_NAMESPACE %>
        <% if config[:sentinels] %>
        :sentinels:
          <% config[:sentinels].each do |sentinel| %>
          -
            :host: <%= sentinel[:host] %>
            :port: <%= sentinel[:port] %>
          <% end %>
        <% end %>
  <% end %>