Reputation: 2584
i have deploy my first app on heroku. Devise work fine in development Environment.
#/config/initializers/devise.rb
#on my local machine
config.mailer_sender = ENV["GMAIL_USERNAME"]
where GMAIL_USERNAME is my personal email address.
In production (on heroku) i want to use sendGrid. How can i change the current devise mailer_sender with a devise "for production" mailer_sender? Simply:
config.mailer_sender = [email protected]
If i use the second solution how can i send mails from development Environment
I'm just a bit confused.
solution:
#/config/application.yml
#this file is generated by figaro gem and edited by me.
GMAIL_USERNAME: "[email protected]"
GMAIL_PASSWORD: "xx"
HOST: "localhost:3000"
SECRET_TOKEN: "dasdasd"
#reconfigure/reset the ENV variables in production environment
production:
GMAIL_USERNAME: [email protected]
GMAIL_PASSWORD: #leave blanck to reset it
HOST: my-app.heroku.com
Upvotes: 0
Views: 647
Reputation: 13354
I would use the Heroku environment variables to do this:
In Terminal:
heroku config:set [email protected] -a <your production app>
This way, your development configuration won't change (assuming you have ENV["GMAIL_USERNAME"]
in your development configuration.
Upvotes: 1