code: func ReadIndexRules(file string) (IndexRules, error) {
  	config, err := configparser.Read(file)
  	if err != nil {
  		return IndexRules{}, err
  	}
  	sections, err := config.AllSections()
  	if err != nil {
  		return IndexRules{}, err
  	}
  
  	result := NewIndexRules()
  
  	for _, s := range sections {
  		item := IndexRule{}
  		item.Name = strings.Trim(strings.SplitN(s.String(), "\n", 2)[0], " []")
  		if item.Name == "" || strings.HasPrefix(item.Name, "#") {
  			continue
  		}
  
  		item.Pattern, err = regexp.Compile(s.ValueOf("pattern"))
  		if err != nil {
  			return IndexRules{}, fmt.Errorf("[%s]: failed to parse pattern %q: %s", item.Name, s.ValueOf("pattern"), err.Error())
  		}
  		duration, err := dur.ParseDuration(s.ValueOf("max-stale"))
  		if err != nil {
  			return IndexRules{}, fmt.Errorf("[%s]: failed to parse max-stale %q: %s", item.Name, s.ValueOf("max-stale"), err.Error())
  		}
  		item.MaxStale = time.Duration(duration) * time.Second
  
  		result.Rules = append(result.Rules, item)
  	}
  
  	return result, nil
  }
docs: // ReadIndexRules returns the defined index rule from a index-rules.conf file
  // and adds the default