-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduction.rb
More file actions
103 lines (79 loc) · 3.89 KB
/
production.rb
File metadata and controls
103 lines (79 loc) · 3.89 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
# config.eager_load = true
config.eager_load = false
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# we don't have any, except public.html which is served by AuthController#index
config.public_file_server.enabled = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Don't log any deprecations.
config.active_support.report_deprecations = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
# if ENV['RAILS_LOG_TO_STDOUT'].present?
# logger = ActiveSupport::Logger.new($stdout)
# logger.formatter = config.log_formatter
# config.logger = ActiveSupport::TaggedLogging.new(logger)
# end
# ------------------------------------------------------------
# Mailer configuration
# TODO: figure out a way to test this
mail_smtp_username = ENV['MAIL_USERNAME'] || 'lib-noreply@berkeley.edu'
mail_smtp_password = ENV['MAIL_PASSWORD']
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_caching = false
smtp_settings = {
address: 'smtp.gmail.com',
port: '465',
domain: 'berkeley.edu',
user_name: mail_smtp_username,
password: mail_smtp_password,
authentication: 'plain',
tls: true
}
config.action_mailer.smtp_settings = smtp_settings
config.after_initialize do
settings_cleaned = smtp_settings.merge(password: mail_smtp_password&.gsub(/./, '*'))
Rails.logger.info('SMTP configured', smtp_settings: settings_cleaned.inspect)
end
if ENV['INTERCEPT_EMAILS'].present?
require Rails.root.join('app/mailers/interceptor/mailing_list_interceptor')
# Route emails to a mailing list in staging
interceptor = Interceptor::MailingListInterceptor.new
ActionMailer::Base.register_interceptor(interceptor)
config.after_initialize do
Rails.logger.info("Intercepting email and routing to #{interceptor.mailing_list.inspect}")
end
end
end