Bläddra i källkod

add SEND_EMAIL_IN_DEVELOPMENT option to .env.example

Andrew Cantino 10 år sedan
förälder
incheckning
1f8ecc29d1

+ 5 - 2
.env.example

@@ -55,8 +55,8 @@ INVITATION_CODE=try-huginn
 # as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.
 #
 # PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment),
-# you must also change config.action_mailer.perform_deliveries in config/environments/development.rb.
-# 
+# you must also set SEND_EMAIL_IN_DEVELOPMENT to true below.
+#
 # If you have trouble with port 587 on Gmail, you can also try setting
 # SMTP_AUTHENTICATION to login and the SMTP_PORT to 465.
 
@@ -68,6 +68,9 @@ SMTP_PORT=587
 SMTP_AUTHENTICATION=plain
 SMTP_ENABLE_STARTTLS_AUTO=true
 
+# Send emails when running in the development Rails environment.
+SEND_EMAIL_IN_DEVELOPMENT=false
+
 # The address from which system emails will appear to be sent.
 EMAIL_FROM_ADDRESS=from_address@gmail.com
 

+ 1 - 1
README.md

@@ -64,7 +64,7 @@ If you just want to play around, you can simply fork this repository, then perfo
 * Read the [wiki][wiki] for usage examples and to get started making new Agents.
 * Periodically run `git fetch upstream` and then `git checkout master && git merge upstream/master` to merge in the newest version of Huginn.
 
-Note: by default, emails are not sent in the `development` Rails environment, which is what you just setup.  If you'd like to enable emails when playing with Huginn locally, edit `config.action_mailer.perform_deliveries` in `config/environments/development.rb`.
+Note: by default, emails are not sent in the `development` Rails environment, which is what you just setup.  If you'd like to enable emails when playing with Huginn locally, set `SEND_EMAIL_IN_DEVELOPMENT` to `true` in your `.env` file.
 
 If you need more detailed instructions, see the [Novice setup guide][novice-setup-guide].
 

+ 1 - 1
config/environments/development.rb

@@ -39,7 +39,7 @@ Huginn::Application.configure do
 
   config.action_mailer.default_url_options = { :host => ENV['DOMAIN'] }
   config.action_mailer.asset_host = ENV['DOMAIN']
-  config.action_mailer.perform_deliveries = false # Enable when testing!
+  config.action_mailer.perform_deliveries = ENV['SEND_EMAIL_IN_DEVELOPMENT'] == 'true'
   config.action_mailer.raise_delivery_errors = true
   config.action_mailer.delivery_method = :smtp
   # smtp_settings moved to config/initializers/action_mailer.rb

+ 5 - 2
deployment/site-cookbooks/huginn_production/files/default/env.example

@@ -46,8 +46,8 @@ INVITATION_CODE=try-huginn
 # Outgoing email settings.  To use Gmail or Google Apps, put your Google Apps domain or gmail.com
 # as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.
 # 
-# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment), 
-# you must also change config.action_mailer.perform_deliveries in config/environments/development.rb.
+# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment),
+# you must also set SEND_EMAIL_IN_DEVELOPMENT to true below.
 
 SMTP_DOMAIN=your-domain-here.com
 SMTP_USER_NAME=you@gmail.com
@@ -57,6 +57,9 @@ SMTP_PORT=587
 SMTP_AUTHENTICATION=plain
 SMTP_ENABLE_STARTTLS_AUTO=true
 
+# Send emails when running in the development Rails environment.
+SEND_EMAIL_IN_DEVELOPMENT=false
+
 # The address from which system emails will appear to be sent.
 EMAIL_FROM_ADDRESS=from_address@gmail.com