0747908873
- 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.
28 lines
1.1 KiB
Go
28 lines
1.1 KiB
Go
package bootstrap
|
|
|
|
import (
|
|
"time"
|
|
"tm/pkg/config"
|
|
)
|
|
|
|
// Config defines the scraper application configuration
|
|
type Config struct {
|
|
Database config.DatabaseConfig
|
|
Logging config.LoggingConfig
|
|
TED ScraperConfig
|
|
Notification config.NotificationConfig
|
|
AlertMail string `env:"ALERT_MAIL" envDefault:"alerts@opplens.com"`
|
|
}
|
|
|
|
type ScraperConfig struct {
|
|
BaseURL string `env:"TED_BASE_URL" envDefault:"https://ted.europa.eu"`
|
|
Timeout time.Duration `env:"TED_TIMEOUT" envDefault:"30s"`
|
|
MaxRetries int `env:"TED_MAX_RETRIES" envDefault:"3"`
|
|
RetryDelay time.Duration `env:"TED_RETRY_DELAY" envDefault:"5s"`
|
|
UserAgent string `env:"TED_USER_AGENT" envDefault:"TM-TED-Scraper/1.0"`
|
|
MaxConcurrency int `env:"TED_MAX_CONCURRENCY" envDefault:"5"`
|
|
DownloadDir string `env:"TED_DOWNLOAD_DIR" envDefault:"./downloads"`
|
|
CleanupAfter time.Duration `env:"TED_CLEANUP_AFTER" envDefault:"24h"`
|
|
ScrapingInterval string `env:"TED_SCRAPING_INTERVAL" envDefault:"* * 10 * * *"`
|
|
}
|