aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/environments/production.rb15
-rw-r--r--config/general.yml-example27
-rw-r--r--config/varnish-alaveteli.vcl16
3 files changed, 49 insertions, 9 deletions
diff --git a/config/environments/production.rb b/config/environments/production.rb
index a3e3cebd2..af2ca15b9 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -17,7 +17,20 @@ Alaveteli::Application.configure do
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
- config.action_mailer.delivery_method = :sendmail # so is queued, rather than giving immediate errors
+
+ config.action_mailer.delivery_method = AlaveteliConfiguration::production_mailer_delivery_method.to_sym
+
+ if AlaveteliConfiguration::production_mailer_delivery_method.to_sym == :smtp
+ config.action_mailer.smtp_settings = {
+ :address => AlaveteliConfiguration::smtp_mailer_address,
+ :port => AlaveteliConfiguration.smtp_mailer_port,
+ :domain => AlaveteliConfiguration.smtp_mailer_domain,
+ :user_name => AlaveteliConfiguration.smtp_mailer_user_name,
+ :password => AlaveteliConfiguration.smtp_mailer_password,
+ :authentication => AlaveteliConfiguration.smtp_mailer_authentication,
+ :enable_starttls_auto => AlaveteliConfiguration.smtp_mailer_enable_starttls_auto
+ }
+ end
config.active_support.deprecation = :notify
diff --git a/config/general.yml-example b/config/general.yml-example
index 8acea374b..88d89958d 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -775,3 +775,30 @@ ALLOW_BATCH_REQUESTS: false
#
# ---
RESPONSIVE_STYLING: true
+
+# Define the mailer delivery method to be used only in the production environment.
+# By default, use sendmail.
+#
+# The list of accepted options are available in the Rails ActionMailer configuration
+# documentation: http://guides.rubyonrails.org/action_mailer_basics.html#example-action-mailer-configuration
+#
+# The most common alternative is to use 'smtp'
+# If you choose to use an external SMTP service then you will need to also include the SMTP configuration settings.
+#
+# As a string this is coerced into a symbol in config/environments/production.rb
+#
+# PRODUCTION_MAILER_DELIVERY_METHOD - String (default: sendmail)
+#
+# Examples:
+#
+# PRODUCTION_MAILER_DELIVERY_METHOD: smtp
+# SMTP_MAILER_ADDRESS: smtp.gmail.com
+# SMTP_MAILER_PORT: 587
+# SMTP_MAILER_DOMAIN: example.com
+# SMTP_MAILER_USER_NAME: jane322
+# SMTP_MAILER_PASSWORD: supersecretpassword
+# SMTP_MAILER_AUTHENTICATION: 'plain'
+# SMTP_MAILER_ENABLE_STARTTLS_AUTO: true
+# ---
+PRODUCTION_MAILER_DELIVERY_METHOD: sendmail
+
diff --git a/config/varnish-alaveteli.vcl b/config/varnish-alaveteli.vcl
index d3726682c..59d76b0d1 100644
--- a/config/varnish-alaveteli.vcl
+++ b/config/varnish-alaveteli.vcl
@@ -2,10 +2,10 @@
# of Alaveteli. See the vcl(7) man page for details on VCL syntax and
# semantics.
-#
+#
# Default backend definition. Set this to point to your content
# server. In this case, apache + Passenger running on port 80
-#
+#
backend default {
.host = "127.0.0.1";
@@ -32,7 +32,7 @@ sub vcl_recv {
# Sanitise X-Forwarded-For...
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
-
+
# Remove Google Analytics, has_js, and last-seen cookies
set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js|has_seen_country_message|seen_foi2)=[^;]*", "");
@@ -50,14 +50,14 @@ sub vcl_recv {
remove req.http.Accept-Encoding;
}
}
-
+
# Ignore empty cookies
if (req.http.Cookie ~ "^\s*$") {
remove req.http.Cookie;
}
-
+
if (req.request != "GET" &&
- req.request != "HEAD" &&
+ req.request != "HEAD" &&
req.request != "POST" &&
req.request != "PUT" &&
req.request != "PURGE" &&
@@ -70,9 +70,9 @@ sub vcl_recv {
/* We only deal with GET and HEAD by default, the rest get passed direct to backend */
return (pass);
}
-
+
# Ignore Cookies on images...
- if (req.url ~ "\.(png|gif|jpg|jpeg|swf|css|js|rdf|ico|txt)(\?.*|)$") {
+ if (req.url ~ "\.(png|gif|jpg|jpeg|swf|css|js|rdf|ico)(\?.*|)$") {
remove req.http.Cookie;
return (lookup);
}