diff --git a/.travis.yml b/.travis.yml index cf2a27a7f..d8959f060 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ env: - STATIC_CHECKS=true global: - secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4=" + - GROWSTUFF_EMAIL="noreply@test.growstuff.org" - GROWSTUFF_SITE_NAME="Growstuff (travis)" - RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' before_install: diff --git a/app.json b/app.json new file mode 100644 index 000000000..fc266aded --- /dev/null +++ b/app.json @@ -0,0 +1,51 @@ +{ + "name": "growstuff", + "stack": "heroku-18", + "description": "Open data project for small-scale food growers", + "scripts": { + "postdeploy": "bundle exec rails db:migrate db:seed" + }, + "env": { + "GROWSTUFF_ELASTICSEARCH": { + "required": true + }, + "GROWSTUFF_FACEBOOK_KEY": { + "required": true + }, + "GROWSTUFF_FACEBOOK_SECRET": { + "required": true + }, + "GROWSTUFF_FLICKR_KEY": { + "required": true + }, + "GROWSTUFF_FLICKR_SECRET": { + "required": true + }, + "GROWSTUFF_SITE_NAME": { + "required": true + }, + "GROWSTUFF_EMAIL": { + "required": true + }, + "MAIL_SENDER_HOST": { + "required": true + } + }, + "formation": { + "web": { + "quantity": 1 + } + }, + "addons": [ + "heroku-postgresql", + "bonsai-elasticsearch", + "memcachier", + "newrelic", + "sparkhost" + ], + "buildpacks": [ + { + "url": "heroku/ruby" + } + ] +} diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index 0d4ea407e..0386450f1 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -1,6 +1,6 @@ class Notifier < ApplicationMailer include NotificationsHelper - default from: "Growstuff " + default from: "Growstuff <#{ENV['GROWSTUFF_EMAIL']}>" def verifier unless ENV['RAILS_SECRET_TOKEN'] diff --git a/config/application.rb b/config/application.rb index 0a00a917a..a42ae3bae 100644 --- a/config/application.rb +++ b/config/application.rb @@ -81,7 +81,7 @@ module Growstuff # Growstuff-specific configuration variables config.currency = 'AUD' - config.bot_email = "noreply@growstuff.org" + config.bot_email = ENV['GROWSTUFF_EMAIL'] config.user_agent = 'Growstuff' config.user_agent_email = "info@growstuff.org" diff --git a/config/application.yml.example b/config/application.yml.example index ba343b6d0..1ff6b5f99 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -75,9 +75,13 @@ GROWSTUFF_ELASTICSEARCH: "false" # To see current settings on Heroku, use "heroku config --app=whatever". ############################################################################## +### EMAil addres for notifier and mailers to use as from +GROWSTUFF_EMAIL: 'noreply@dev.growstuff.org' + test: GROWSTUFF_SITE_NAME: Growstuff (test) GROWSTUFF_CAPYBARA_DRIVER: poltergeist + GROWSTUFF_EMAIL: 'noreply@test.growstuff.org' # Note: there is no good way to deploy settings from Figaro to # Travis-CI. If you need env vars set there in order for tests to pass, @@ -86,7 +90,9 @@ test: staging: GROWSTUFF_SITE_NAME: Growstuff (staging) GROWSTUFF_ELASTICSEARCH: "true" + GROWSTUFF_EMAIL: 'noreply@staging.growstuff.org' production: GROWSTUFF_SITE_NAME: Growstuff GROWSTUFF_ELASTICSEARCH: "true" + GROWSTUFF_EMAIL: 'noreply@growstuff.org' diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index fcb4caecc..974551c93 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -5,7 +5,7 @@ Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class with default "from" parameter. - config.mailer_sender = "Growstuff " + config.mailer_sender = "Growstuff <#{ENV['GROWSTUFF_EMAIL']}>" config.secret_key = ENV['RAILS_SECRET_TOKEN'] diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index e50682700..27677eab6 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -9,8 +9,8 @@ describe Notifier do mail.subject.should == notification.subject end - it 'comes from noreply@growstuff.org' do - mail.from.should == ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + mail.from.should == ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -26,8 +26,8 @@ describe Notifier do mail.subject.should == "What have you planted lately?" end - it 'comes from noreply@growstuff.org' do - mail.from.should == ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + mail.from.should == ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -52,8 +52,8 @@ describe Notifier do mail.subject.should == "#{crop.requester.login_name} has requested Ultra berry as a new crop" end - it 'comes from noreply@growstuff.org' do - mail.from.should == ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + mail.from.should == ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -74,8 +74,8 @@ describe Notifier do expect(mail.subject).to eq "Magic bean has been approved" end - it 'comes from noreply@growstuff.org' do - expect(mail.from).to eq ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + expect(mail.from).to eq ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -102,8 +102,8 @@ describe Notifier do expect(mail.subject).to eq "Fail bean has been rejected" end - it 'comes from noreply@growstuff.org' do - expect(mail.from).to eq ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + expect(mail.from).to eq ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do