Add mailer settings back

pull/298/head
Rick Carlino 2016-11-23 10:40:00 -06:00
parent b24d5ccee2
commit d016d4ad96
2 changed files with 19 additions and 5 deletions

View File

@ -50,6 +50,9 @@ Here are some of the configuration options you must set when provisioning a new
* `ENV['API_PORT']`: Port the server is on. Default is `3000`.
* `ENV['FORCE_SSL']`: Optional, but *highly* recomended if you are going to support HTTPS.
* `ENV['ACME_SECRET']`: If you're using ACME based SSL verification (like Let's Encrypt), set this to your ACME challenge string.
* `ENV['SMTP_USERNAME']`: Email server username.
* `ENV['SMTP_PASSWORD']`: Email server password.
* `ENV['SMTP_HOST']`: Email server host name (Eg: `smtp.sendgrid.net`).
**We can't fix issues we don't know about.** Please submit an issue if you are having trouble installing on your local machine.

View File

@ -4,15 +4,26 @@ FarmBot::Application.configure do
config.action_mailer.default_url_options = { host: 'my.farmbot.io' }
config.active_support.deprecation = :notify
config.cache_classes = true
config.consider_all_requests_local = false
config.consider_all_requests_local = false
config.eager_load = true
config.i18n.fallbacks = true
config.log_formatter = ::Logger::Formatter.new
config.log_level = :info
config.serve_static_files = false
config.action_mailer.smtp_settings = { address: 'smtp.mandrillapp.com',
port: 587,
user_name: ENV['MANDRILL_USERNAME'],
password: ENV['MANDRILL_APIKEY'] }
# HACK AHEAD! Here's why:
# 1. FarmBot Inc. Uses Sendgrid for email.
# 2. FarmBot is an open source project that must be vendor neutral.
# 3. Heroku uses non-neutral ENV names like "SENDGRID_PASSWORD"
# SOLUTION: Support neutral names like "SMTP_HOST",
# but fallback to non-neutral var names like "SENDGRID_USERNAME" if
# required.
pw = ENV['SMTP_PASSWORD'] || ENV['SENDGRID_PASSWORD']
uname = ENV['SMTP_USERNAME'] || ENV['SENDGRID_USERNAME']
config.action_mailer.smtp_settings = { port: 587,
address: ENV['SMTP_HOST'],
user_name: uname,
password: pw }
end