NOTE: parseExpiresFromConfig and parseRelativeTimeSpec have been moved to time_delta.go to consolidate all time parsing logic in a single location. These functions are used for parsing expiration configurations in safe output jobs. ParseBoolFromConfig is a generic helper that extracts and validates
(m map[string]any, key string, debugLog *logger.Logger)
| 143 | // Returns the boolean value, or false if not present or invalid. |
| 144 | // If log is provided, it will log the extracted value for debugging. |
| 145 | func ParseBoolFromConfig(m map[string]any, key string, debugLog *logger.Logger) bool { |
| 146 | if debugLog != nil { |
| 147 | debugLog.Printf("Parsing %s from config", key) |
| 148 | } |
| 149 | result := typeutil.ParseBool(m, key) |
| 150 | if debugLog != nil { |
| 151 | debugLog.Printf("Parsed %s from config: %t", key, result) |
| 152 | } |
| 153 | return result |
| 154 | } |
| 155 | |
| 156 | // unmarshalConfig unmarshals a config value from a map into a typed struct using YAML. |
| 157 | // This provides type-safe parsing by leveraging YAML struct tags on config types. |