diff options
author | Effy Elden <git@effy.is> | 2017-01-17 22:00:03 +1100 |
---|---|---|
committer | Effy Elden <git@effy.is> | 2017-01-17 22:00:03 +1100 |
commit | ab4f5f5da5229bbc33f3c86815eaf1e057c697b1 (patch) | |
tree | 7bab737c8ed6b113e213ba7334d28b6c9855a781 /config/environments/production.rb | |
parent | 6cf44ca92c3b92df5bda32adb59258104f1ac9c5 (diff) |
Add Heroku deployment support
Diffstat (limited to 'config/environments/production.rb')
-rw-r--r-- | config/environments/production.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/config/environments/production.rb b/config/environments/production.rb index 9254d494cef..8b8d974b315 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -45,10 +45,20 @@ Rails.application.configure do # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # Parse and split the REDIS_URL if passed (used with hosting platforms such as Heroku). + # Set ENV variables because they are used elsewhere. + if ENV['REDIS_URL'] + redis_url = URI.parse(ENV['REDIS_URL']) + ENV['REDIS_HOST'] = redis_url.host + ENV['REDIS_PORT'] = redis_url.port.to_s + ENV['REDIS_PASSWORD'] = redis_url.password + end + # Use a different cache store in production. config.cache_store = :redis_store, { host: ENV.fetch('REDIS_HOST') { 'localhost' }, port: ENV.fetch('REDIS_PORT') { 6379 }, + password: ENV.fetch('REDIS_PASSWORD') { false }, db: 0, namespace: 'cache', expires_in: 20.minutes @@ -85,7 +95,7 @@ Rails.application.configure do :address => ENV['SMTP_SERVER'], :user_name => ENV['SMTP_LOGIN'], :password => ENV['SMTP_PASSWORD'], - :domain => config.x.local_domain, + :domain => ENV['SMTP_DOMAIN'] || config.x.local_domain, :authentication => :plain, } |