parsePhasesConfig converts raw viper phases data into typed PhaseConfig entries.
(raw any)
| 290 | |
| 291 | // parsePhasesConfig converts raw viper phases data into typed PhaseConfig entries. |
| 292 | func parsePhasesConfig(raw any) []validator.PhaseConfig { |
| 293 | if raw == nil { |
| 294 | return nil |
| 295 | } |
| 296 | items, ok := raw.([]any) |
| 297 | if !ok { |
| 298 | return nil |
| 299 | } |
| 300 | |
| 301 | phases := make([]validator.PhaseConfig, 0, len(items)) |
| 302 | for _, item := range items { |
| 303 | m, ok := item.(map[string]any) |
| 304 | if !ok { |
| 305 | continue |
| 306 | } |
| 307 | mc, valid := parsePhaseEntry(m) |
| 308 | if valid { |
| 309 | phases = append(phases, mc) |
| 310 | } |
| 311 | } |
| 312 | return phases |
| 313 | } |
| 314 | |
| 315 | func parsePhaseEntry(m map[string]any) (validator.PhaseConfig, bool) { |
| 316 | mc := validator.PhaseConfig{} |