This PR updates the seed file to create a substantial amount of notification data for testing and development purposes. Additionally, it implements a mechanism to skip sending email notifications during the seeding process. This is achieved by using a global configuration controlled by an environment variable.
Key Changes
Seed File Updates:
The db/seeds.rb file has been modified to create 1000 notifications for each type (NewAircraftCreatedNotification, LogbookEntryUpdatedNotification, NewLogbookEntryCreatedNotification, UserSignUpNotification, and UserUpdateNotification).
Skip Email Notifications:
Introduced a global configuration in config/application.rb to control email notifications using the SEND_EMAIL_NOTIFICATIONS environment variable.
Updated notification classes to check the global configuration before sending email notifications.
Files Changed
config/application.rb: Added config.send_email_notifications controlled by SEND_EMAIL_NOTIFICATIONS environment variable.
config/environments/development.rb: Set SEND_EMAIL_NOTIFICATIONS to false to skip email notifications in development.
notification classes: Updated to conditionally skip email notifications based on the global configuration.
db/seeds.rb: Modified to create a large amount of notification data without sending emails.
Instructions
Set Environment Variable
For development and test environments, set the environment variable to false to skip email notifications:
Description
This PR updates the seed file to create a substantial amount of notification data for testing and development purposes. Additionally, it implements a mechanism to skip sending email notifications during the seeding process. This is achieved by using a global configuration controlled by an environment variable.
Key Changes
Seed File Updates:
db/seeds.rb
file has been modified to create 1000 notifications for each type (NewAircraftCreatedNotification
,LogbookEntryUpdatedNotification
,NewLogbookEntryCreatedNotification
,UserSignUpNotification
, andUserUpdateNotification
).Skip Email Notifications:
config/application.rb
to control email notifications using theSEND_EMAIL_NOTIFICATIONS
environment variable.Files Changed
config.send_email_notifications
controlled bySEND_EMAIL_NOTIFICATIONS
environment variable.SEND_EMAIL_NOTIFICATIONS
tofalse
to skip email notifications in development.Instructions
Set Environment Variable
For development and test environments, set the environment variable to
false
to skip email notifications:How to Test
Development Environment: