Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
bbdb9ba0
Commit
bbdb9ba0
authored
Feb 26, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't load all of GitLab in mail_room
Fixes #12731
parent
01160fc0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
41 deletions
+129
-41
CHANGELOG
CHANGELOG
+1
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-5
config/mail_room.yml
config/mail_room.yml
+49
-36
spec/config/mail_room_spec.rb
spec/config/mail_room_spec.rb
+56
-0
spec/fixtures/mail_room_disabled.yml
spec/fixtures/mail_room_disabled.yml
+11
-0
spec/fixtures/mail_room_enabled.yml
spec/fixtures/mail_room_enabled.yml
+11
-0
No files found.
CHANGELOG
View file @
bbdb9ba0
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.6.0 (unreleased)
v 8.6.0 (unreleased)
- Improve the formatting for the user page bio (Connor Shea)
- Improve the formatting for the user page bio (Connor Shea)
- Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
- Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
- Don't load all of GitLab in mail_room
v 8.5.1
v 8.5.1
- Fix group projects styles
- Fix group projects styles
...
...
config/initializers/1_settings.rb
View file @
bbdb9ba0
...
@@ -207,11 +207,7 @@ Settings.gitlab_ci['builds_path'] = File.expand_path(Settings.gitlab_c
...
@@ -207,11 +207,7 @@ Settings.gitlab_ci['builds_path'] = File.expand_path(Settings.gitlab_c
# Reply by email
# Reply by email
#
#
Settings
[
'incoming_email'
]
||=
Settingslogic
.
new
({})
Settings
[
'incoming_email'
]
||=
Settingslogic
.
new
({})
Settings
.
incoming_email
[
'enabled'
]
=
false
if
Settings
.
incoming_email
[
'enabled'
].
nil?
Settings
.
incoming_email
[
'enabled'
]
=
false
if
Settings
.
incoming_email
[
'enabled'
].
nil?
Settings
.
incoming_email
[
'port'
]
=
143
if
Settings
.
incoming_email
[
'port'
].
nil?
Settings
.
incoming_email
[
'ssl'
]
=
false
if
Settings
.
incoming_email
[
'ssl'
].
nil?
Settings
.
incoming_email
[
'start_tls'
]
=
false
if
Settings
.
incoming_email
[
'start_tls'
].
nil?
Settings
.
incoming_email
[
'mailbox'
]
=
"inbox"
if
Settings
.
incoming_email
[
'mailbox'
].
nil?
#
#
# Build Artifacts
# Build Artifacts
...
...
config/mail_room.yml
View file @
bbdb9ba0
:mailboxes:
:mailboxes:
<%
<%
require_relative 'config/environment.rb'
require "yaml"
require "json"
if Gitlab::IncomingEmail.enabled?
config = Gitlab::IncomingEmail.config
rails_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
redis_config_file = "config/resque.yml"
config_file = ENV["MAIL_ROOM_GITLAB_CONFIG_FILE"] || "config/gitlab.yml"
redis_url =
if File.exists?(config_file)
if File.exists?(redis_config_file)
all_config = YAML.load_file(config_file)[rails_env]
YAML.load_file(redis_config_file)[Rails.env]
else
config = all_config["incoming_email"] || {}
"redis://localhost:6379"
config['enabled'] =
false
if config['enabled'].nil?
end
config['port'] = 143 if config['port'].nil?
%>
config['ssl'] =
false
if config['ssl'].nil?
-
config['start_tls'] =
false
if config['start_tls'].nil?
:host: <%= config.host.to_json %>
config['mailbox'] = "inbox" if config['mailbox'].nil?
:port: <%= config.port.to_json %>
:ssl: <%= config.ssl.to_json %>
if config['enabled'] && config['address'] && config['address'].include?('%{key}')
:start_tls: <%= config.start_tls.to_json %>
redis_config_file = "config/resque.yml"
:email: <%= config.user.to_json %>
redis_url =
:password: <%= config.password.to_json %>
if File.exists?(redis_config_file)
YAML.load_file(redis_config_file)[rails_env]
:name: <%= config.mailbox.to_json %>
else
"redis://localhost:6379"
:delete_after_delivery:
true
end
%>
:delivery_method: sidekiq
-
:delivery_options:
:host: <%= config['host'].to_json %>
:redis_url: <%= redis_url.to_json %>
:port: <%= config['port'].to_json %>
:namespace: resque:gitlab
:ssl: <%= config['ssl'].to_json %>
:queue: incoming_email
:start_tls: <%= config['start_tls'].to_json %>
:worker: EmailReceiverWorker
:email: <%= config['user'].to_json %>
:password: <%= config['password'].to_json %>
:arbitration_method: redis
:arbitration_options:
:name: <%= config['mailbox'].to_json %>
:redis_url: <%= redis_url.to_json %>
:namespace: mail_room:gitlab
: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 %>
<% end %>
<% end %>
spec/config/mail_room_spec.rb
0 → 100644
View file @
bbdb9ba0
require
"spec_helper"
describe
"mail_room.yml"
do
let
(
:config_path
)
{
"config/mail_room.yml"
}
let
(
:configuration
)
{
YAML
.
load
(
ERB
.
new
(
File
.
read
(
config_path
)).
result
)
}
context
"when incoming email is disabled"
do
before
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
Rails
.
root
.
join
(
"spec/fixtures/mail_room_disabled.yml"
).
to_s
end
after
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
nil
end
it
"contains no configuration"
do
expect
(
configuration
[
:mailboxes
]).
to
be_nil
end
end
context
"when incoming email is enabled"
do
before
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
Rails
.
root
.
join
(
"spec/fixtures/mail_room_enabled.yml"
).
to_s
end
after
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
nil
end
it
"contains the intended configuration"
do
expect
(
configuration
[
:mailboxes
].
length
).
to
eq
(
1
)
mailbox
=
configuration
[
:mailboxes
].
first
expect
(
mailbox
[
:host
]).
to
eq
(
"imap.gmail.com"
)
expect
(
mailbox
[
:port
]).
to
eq
(
993
)
expect
(
mailbox
[
:ssl
]).
to
eq
(
true
)
expect
(
mailbox
[
:start_tls
]).
to
eq
(
false
)
expect
(
mailbox
[
:email
]).
to
eq
(
"gitlab-incoming@gmail.com"
)
expect
(
mailbox
[
:password
]).
to
eq
(
"[REDACTED]"
)
expect
(
mailbox
[
:name
]).
to
eq
(
"inbox"
)
redis_config_file
=
Rails
.
root
.
join
(
'config'
,
'resque.yml'
)
redis_url
=
if
File
.
exists?
(
redis_config_file
)
YAML
.
load_file
(
redis_config_file
)[
Rails
.
env
]
else
"redis://localhost:6379"
end
expect
(
mailbox
[
:delivery_options
][
:redis_url
]).
to
eq
(
redis_url
)
expect
(
mailbox
[
:arbitration_options
][
:redis_url
]).
to
eq
(
redis_url
)
end
end
end
spec/fixtures/mail_room_disabled.yml
0 → 100644
View file @
bbdb9ba0
test
:
incoming_email
:
enabled
:
false
address
:
"
gitlab-incoming+%{key}@gmail.com"
user
:
"
gitlab-incoming@gmail.com"
password
:
"
[REDACTED]"
host
:
"
imap.gmail.com"
port
:
993
ssl
:
true
start_tls
:
false
mailbox
:
"
inbox"
spec/fixtures/mail_room_enabled.yml
0 → 100644
View file @
bbdb9ba0
test
:
incoming_email
:
enabled
:
true
address
:
"
gitlab-incoming+%{key}@gmail.com"
user
:
"
gitlab-incoming@gmail.com"
password
:
"
[REDACTED]"
host
:
"
imap.gmail.com"
port
:
993
ssl
:
true
start_tls
:
false
mailbox
:
"
inbox"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment