MCPcopy
hub / github.com/windtf/wireproxy / parseRoutinesConfig

Function parseRoutinesConfig

config.go:500–516  ·  view source on GitHub ↗

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))

Source from the content-addressed store, hash-verified

498// Takes a function that parses an individual section into a config, and apply it on all
499// specified sections
500func 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
519func ParseConfig(path string) (*Configuration, error) {

Callers 1

ParseConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected