57c29dc58f
- Removed YAML configuration files for the scraper and web commands, transitioning to an environment-based configuration system. - Updated configuration structs to utilize `env` tags for loading values from `.env` files, enhancing security and flexibility. - Implemented reflection-based parsing for environment variables, ensuring type-safe configuration loading. - Revised documentation to reflect the new configuration approach, including usage examples and best practices for environment variable naming conventions.
26 lines
762 B
Go
26 lines
762 B
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
|
|
}
|
|
|
|
type ScraperConfig struct {
|
|
BaseURL string `env:"TED_BASE_URL"`
|
|
Timeout time.Duration `env:"TED_TIMEOUT"`
|
|
MaxRetries int `env:"TED_MAX_RETRIES"`
|
|
RetryDelay time.Duration `env:"TED_RETRY_DELAY"`
|
|
UserAgent string `env:"TED_USER_AGENT"`
|
|
MaxConcurrency int `env:"TED_MAX_CONCURRENCY"`
|
|
DownloadDir string `env:"TED_DOWNLOAD_DIR"`
|
|
CleanupAfter time.Duration `env:"TED_CLEANUP_AFTER"`
|
|
ScrapingInterval time.Duration `env:"TED_SCRAPING_INTERVAL"`
|
|
}
|