func()

in groups/reconcile.go [340:368]


func (c *Config) Load(configFilePath string, confirmChanges bool) error {
	log.Printf("reading config file: %s", configFilePath)
	content, err := ioutil.ReadFile(configFilePath)
	if err != nil {
		return fmt.Errorf("error reading config file %s: %w", configFilePath, err)
	}
	if err = yaml.Unmarshal(content, &c); err != nil {
		return fmt.Errorf("error parsing config file %s: %w", configFilePath, err)
	}

	if !filepath.IsAbs(c.GroupsPath) {
		c.GroupsPath = filepath.Clean(filepath.Join(filepath.Dir(configFilePath), c.GroupsPath))
	}
	c.GroupsPath, err = filepath.Abs(c.GroupsPath)
	if err != nil {
		return fmt.Errorf("error converting groups-path %v to absolute path: %w", c.GroupsPath, err)
	}

	if c.RestrictionsPath == "" {
		c.RestrictionsPath = filepath.Join(filepath.Dir(configFilePath), defaultRestrictionsFile)
	}
	c.RestrictionsPath, err = filepath.Abs(c.RestrictionsPath)
	if err != nil {
		return fmt.Errorf("error converting retrictions-path %v to absolute path: %w", c.RestrictionsPath, err)
	}

	c.ConfirmChanges = confirmChanges
	return err
}