Files
tm_back/cmd/scraper/main.go
T
n.nakhostin 96c21b8b78 Implement TED Scraper and Configuration Management
- Introduced a new TED scraper in `cmd/scraper` to handle downloading and parsing TED XML files.
- Added configuration management for the scraper, including a new `Config` struct and YAML configuration file.
- Created necessary handler, service, and repository layers for tender management, adhering to Clean Architecture principles.
- Implemented comprehensive logging and error handling throughout the scraper functionality.
- Updated API routes to include tender management operations, enhancing the overall system capabilities.
2025-08-13 16:52:24 +03:30

38 lines
872 B
Go

package main
import (
"context"
"log"
"time"
)
func main() {
// Load configuration
config, err := LoadConfig(".")
if err != nil {
log.Fatalf("Failed to load configuration: %v", err)
}
// Initialize logger
appLogger := initLogger(config.Logging)
appLogger.Info("Starting TED scraper application", map[string]interface{}{
"version": "1.0.0",
})
// Initialize MongoDB connection
mongoManager := initMongoDB(config.Database.MongoDB, appLogger)
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if err := mongoManager.Close(ctx); err != nil {
appLogger.Error("Failed to close MongoDB connection", map[string]interface{}{
"error": err.Error(),
})
}
}()
initTEDScraper(*config, mongoManager, appLogger)
appLogger.Info("TED scraper application stopped", map[string]interface{}{})
}