Add AlertMail Configuration and Enhance TED Scraper Notification Logic
- Introduced AlertMail configuration in both scraper and worker bootstrap files, allowing for customizable email notifications. - Updated the TED scraper to utilize the AlertMail configuration for sending completion notifications, improving flexibility in notification management. - Enhanced error logging in the worker's main function to capture issues when listing Ollama models, ensuring better visibility into potential failures. - Refactored notification sending logic to check for a valid AlertMail before dispatching emails, ensuring notifications are only sent when configured. - Improved overall structure and readability of the bootstrap configuration files, aligning with best practices for maintainability.
This commit is contained in:
@@ -79,6 +79,9 @@ func InitWorker(config Config, mongoManager *mongo.ConnectionManager, appLogger
|
||||
noticeRepo := notice.NewRepository(mongoManager, appLogger)
|
||||
tenderRepo := tender.NewRepository(mongoManager, appLogger)
|
||||
|
||||
worker := workers.NewNoticeWorker(mongoManager, appLogger, notify, noticeRepo, tenderRepo, ollamaSDK)
|
||||
worker.Run()
|
||||
|
||||
// start Worker job
|
||||
schedule.NewCronScheduler(appLogger, mongoManager, noticeRepo).AddJob(schedule.Job{
|
||||
Name: "Worker Job",
|
||||
|
||||
@@ -11,6 +11,7 @@ type Config struct {
|
||||
Notification config.NotificationConfig
|
||||
Ollama config.OllamaConfig
|
||||
Worker WorkerConfig
|
||||
AlertMail string `env:"ALERT_MAIL" envDefault:"alerts@opplens.com"`
|
||||
}
|
||||
|
||||
type WorkerConfig struct {
|
||||
|
||||
Reference in New Issue
Block a user