Commit 582e1cdd8da90ae7ba96d92176a1ef4b342c9e71
Exists in
master
and in
9 other branches
Merge branch 'smtp_settings_robustness' into 'master'
Smtp settings robustness
Showing
3 changed files
with
7 additions
and
9 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/attributes/default.rb
| @@ -134,7 +134,7 @@ default['gitlab']['gitlab-rails']['smtp_port'] = nil | @@ -134,7 +134,7 @@ default['gitlab']['gitlab-rails']['smtp_port'] = nil | ||
| 134 | default['gitlab']['gitlab-rails']['smtp_user_name'] = nil | 134 | default['gitlab']['gitlab-rails']['smtp_user_name'] = nil |
| 135 | default['gitlab']['gitlab-rails']['smtp_password'] = nil | 135 | default['gitlab']['gitlab-rails']['smtp_password'] = nil |
| 136 | default['gitlab']['gitlab-rails']['smtp_domain'] = nil | 136 | default['gitlab']['gitlab-rails']['smtp_domain'] = nil |
| 137 | -default['gitlab']['gitlab-rails']['smtp_authentication'] = "login" | 137 | +default['gitlab']['gitlab-rails']['smtp_authentication'] = nil |
| 138 | default['gitlab']['gitlab-rails']['smtp_enable_starttls_auto'] = nil | 138 | default['gitlab']['gitlab-rails']['smtp_enable_starttls_auto'] = nil |
| 139 | 139 | ||
| 140 | #### | 140 | #### |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
| @@ -101,7 +101,6 @@ end | @@ -101,7 +101,6 @@ end | ||
| 101 | 101 | ||
| 102 | template_symlink File.join(gitlab_rails_etc_dir, "smtp_settings.rb") do | 102 | template_symlink File.join(gitlab_rails_etc_dir, "smtp_settings.rb") do |
| 103 | link_from File.join(gitlab_rails_source_dir, "config/initializers/smtp_settings.rb") | 103 | link_from File.join(gitlab_rails_source_dir, "config/initializers/smtp_settings.rb") |
| 104 | - helpers SingleQuoteHelper | ||
| 105 | owner "root" | 104 | owner "root" |
| 106 | group "root" | 105 | group "root" |
| 107 | mode "0644" | 106 | mode "0644" |
files/gitlab-cookbooks/gitlab/templates/default/smtp_settings.rb.erb
| @@ -6,12 +6,11 @@ if Rails.env.production? | @@ -6,12 +6,11 @@ if Rails.env.production? | ||
| 6 | Gitlab::Application.config.action_mailer.delivery_method = :smtp | 6 | Gitlab::Application.config.action_mailer.delivery_method = :smtp |
| 7 | 7 | ||
| 8 | ActionMailer::Base.smtp_settings = { | 8 | ActionMailer::Base.smtp_settings = { |
| 9 | - address: <%= single_quote(@smtp_address) %>, | ||
| 10 | - port: <%= @smtp_port %>, | ||
| 11 | - user_name: <%= single_quote(@smtp_user_name) %>, | ||
| 12 | - password: <%= single_quote(@smtp_password) %>, | ||
| 13 | - domain: <%= single_quote(@smtp_domain) %>, | ||
| 14 | - authentication: :<%= @smtp_authentication %>, | ||
| 15 | - enable_starttls_auto: <%= @smtp_enable_starttls_auto %> | 9 | + authentication: <%= @smtp_authentication.to_s.to_sym.inspect %>, |
| 10 | +<% %w{ address port user_name password domain enable_starttls_auto }.each do |key| %> | ||
| 11 | + <% if value = node['gitlab']['gitlab-rails']["smtp_#{key}"] %> | ||
| 12 | + <%= "#{key}: #{value.inspect}," %> | ||
| 13 | + <% end %> | ||
| 14 | +<% end %> | ||
| 16 | } | 15 | } |
| 17 | end | 16 | end |