2015-10-13 07:07:59 -04:00
|
|
|
:mailboxes:
|
|
|
|
<%
|
2016-02-26 21:48:13 -05:00
|
|
|
require "yaml"
|
|
|
|
require "json"
|
2016-03-09 09:16:46 -05:00
|
|
|
require_relative "lib/gitlab/redis_config"
|
2016-02-26 21:48:13 -05:00
|
|
|
|
|
|
|
rails_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
|
|
|
|
|
|
|
|
config_file = ENV["MAIL_ROOM_GITLAB_CONFIG_FILE"] || "config/gitlab.yml"
|
|
|
|
if File.exists?(config_file)
|
|
|
|
all_config = YAML.load_file(config_file)[rails_env]
|
|
|
|
|
|
|
|
config = all_config["incoming_email"] || {}
|
|
|
|
config['enabled'] = false if config['enabled'].nil?
|
|
|
|
config['port'] = 143 if config['port'].nil?
|
|
|
|
config['ssl'] = false if config['ssl'].nil?
|
|
|
|
config['start_tls'] = false if config['start_tls'].nil?
|
|
|
|
config['mailbox'] = "inbox" if config['mailbox'].nil?
|
|
|
|
|
|
|
|
if config['enabled'] && config['address'] && config['address'].include?('%{key}')
|
2016-03-09 09:16:46 -05:00
|
|
|
redis_url = Gitlab::RedisConfig.new(rails_env).url
|
2016-02-26 21:48:13 -05:00
|
|
|
%>
|
|
|
|
-
|
|
|
|
: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 %>
|
|
|
|
|
|
|
|
:name: <%= config['mailbox'].to_json %>
|
|
|
|
|
|
|
|
:delete_after_delivery: true
|
|
|
|
|
|
|
|
:delivery_method: sidekiq
|
|
|
|
:delivery_options:
|
|
|
|
:redis_url: <%= redis_url.to_json %>
|
|
|
|
:namespace: resque:gitlab
|
|
|
|
:queue: incoming_email
|
|
|
|
:worker: EmailReceiverWorker
|
|
|
|
|
|
|
|
:arbitration_method: redis
|
|
|
|
:arbitration_options:
|
|
|
|
:redis_url: <%= redis_url.to_json %>
|
|
|
|
:namespace: mail_room:gitlab
|
|
|
|
<% end %>
|
2015-10-13 07:07:59 -04:00
|
|
|
<% end %>
|