diff --git a/config/config.go b/config/config.go index 90f5076..bc651eb 100644 --- a/config/config.go +++ b/config/config.go @@ -18,15 +18,6 @@ const ( EnvResponseTimeout = "RESPONSE_TIMEOUT" ) -// Default configuration values -const ( - DefaultLogLevel = zerolog.InfoLevel - DefaultNumWorkers = 5 - DefaultWorkerBatchSize = 100 - DefaultMaxResponseSize = 1048576 // 1MB - DefaultResponseTimeout = 30 // seconds -) - // Config holds the application configuration loaded from environment variables type Config struct { LogLevel zerolog.Level // Logging level (debug, info, warn, error) @@ -34,7 +25,7 @@ type Config struct { MaxResponseSize int // Maximum size of response in bytes NumOfWorkers int // Number of concurrent workers ResponseTimeout int // Timeout for responses in seconds - WorkerBatchSize int // Batch size for worker processing + WorkerBatchSize int // Batch size for worker processing } // String returns a string representation of the configuration @@ -62,7 +53,7 @@ func parsePositiveInt(value string) (int, error) { // GetConfig loads and validates configuration from environment variables func GetConfig() *Config { config := &Config{} - + // Map of environment variables to their parsing functions parsers := map[string]func(string) error{ EnvLogLevel: func(v string) error { @@ -121,7 +112,7 @@ func GetConfig() *Config { fmt.Fprintf(os.Stderr, "Missing required environment variable: %s\n", envVar) os.Exit(1) } - + if err := parser(value); err != nil { fmt.Fprintf(os.Stderr, "Configuration error: %v\n", err) os.Exit(1)