Takes a function that parses an individual section into a config, and apply it on all specified sections
(routines *[]RoutineSpawner, cfg *ini.File, sectionName string, f func(*ini.Section) (RoutineSpawner, error))
| 498 | // Takes a function that parses an individual section into a config, and apply it on all |
| 499 | // specified sections |
| 500 | func parseRoutinesConfig(routines *[]RoutineSpawner, cfg *ini.File, sectionName string, f func(*ini.Section) (RoutineSpawner, error)) error { |
| 501 | sections, err := cfg.SectionsByName(sectionName) |
| 502 | if err != nil { |
| 503 | return nil |
| 504 | } |
| 505 | |
| 506 | for _, section := range sections { |
| 507 | config, err := f(section) |
| 508 | if err != nil { |
| 509 | return err |
| 510 | } |
| 511 | |
| 512 | *routines = append(*routines, config) |
| 513 | } |
| 514 | |
| 515 | return nil |
| 516 | } |
| 517 | |
| 518 | // ParseConfig takes the path of a configuration file and parses it into Configuration |
| 519 | func ParseConfig(path string) (*Configuration, error) { |