diff --git a/.env.example b/.env.example index 80fec6985..d4fb1ea12 100644 --- a/.env.example +++ b/.env.example @@ -105,3 +105,7 @@ CHARGEBEE_WEBHOOK_PASSWORD= ## Bot Customizations USE_INBOX_AVATAR_FOR_BOT=true + +## Development Only Config +# if you want to use letter_opener for local emails +# LETTER_OPENER=true diff --git a/config/environments/development.rb b/config/environments/development.rb index f1f3174ed..88ebfe82c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,18 +34,12 @@ Rails.application.configure do config.active_job.queue_adapter = :sidekiq + # Email related config config.action_mailer.perform_caching = false - config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } - config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { host: 'localhost:3000' } + config.action_mailer.default_url_options = { host: ENV['FRONTEND_URL'] } - # If you want to use letter opener instead of mailhog for testing emails locally, - # uncomment the following line L49 and comment lines L51 through to L65 - # config.action_mailer.delivery_method = :letter_opener - - config.action_mailer.delivery_method = :smtp smtp_settings = { port: ENV['SMTP_PORT'] || 25, domain: ENV['SMTP_DOMAIN'] || 'localhost', @@ -59,7 +53,12 @@ Rails.application.configure do smtp_settings[:enable_starttls_auto] = ENV['SMTP_ENABLE_STARTTLS_AUTO'] if ENV['SMTP_ENABLE_STARTTLS_AUTO'].present? end - config.action_mailer.smtp_settings = smtp_settings + if ENV['LETTER_OPENER'] + config.action_mailer.delivery_method = :letter_opener + else + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = smtp_settings + end # Set this to appropriate ingress service for which the options are : # :relay for Exim, Postfix, Qmail @@ -69,7 +68,7 @@ Rails.application.configure do # :sendgrid for Sendgrid config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym - Rails.application.routes.default_url_options = { host: 'localhost', port: 3000 } + Rails.application.routes.default_url_options = { host: ENV['FRONTEND_URL'] } # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log