medusa-project / book-tracker

Medusa Book Tracker
0 stars 0 forks source link

Modify emails to administrators #40

Closed adolski closed 9 months ago

adolski commented 9 months ago

In ApplicationController, there is this line: rescue_from StandardError, with: :error_occurred

This causes the error_occurred() method (defined later in the same file) to be invoked for all unhandled errors.

One important thing this method does is send an email to the Book Tracker administrator, using BookTrackerMailer. Up until now, the administrator been me. But now, it should be both of us.

BookTrackerMailer.error() reads the admin email from the configuration: ::Configuration.instance.admin_email. We should modify this config key to be an array of emails (ours) instead of a single value. That will probably mean renaming it to something like admin_emails in all of the config files and then changing all references to the key in the code, and making sure that all of the places that were reading the email as a string can also cope with reading an array of strings.

gaurijo commented 9 months ago

I'm looking through how this is set up before I try to make any changes, and as of now my configuration (development) shows the admin_email as being my personal gmail account (I think that's how we set it up when I was first onboarding onto BookTracker). When updating the config keys to be an array of emails, should it be both of our illinois.edu emails?

Image

adolski commented 9 months ago

It's not necessary to modify anything in the smtp section. For the admin_email, you can use whatever email you want to receive error notifications. For me (in the demo & production configurations), it should be alexd@illinois.edu.