config/apply: only request the []FileDef, not the full config
This commit is contained in:
		| @ -12,7 +12,7 @@ import ( | ||||
| ) | ||||
|  | ||||
| // Files writes the files from the given config | ||||
| func Files(cfg *config.Config, prefix string, filters ...string) error { | ||||
| func Files(cfgFiles []config.FileDef, prefix string, filters ...string) error { | ||||
| 	accept := func(n string) bool { return true } | ||||
|  | ||||
| 	if len(filters) > 0 { | ||||
| @ -30,7 +30,7 @@ func Files(cfg *config.Config, prefix string, filters ...string) error { | ||||
|  | ||||
| 	failed := 0 | ||||
|  | ||||
| 	for _, file := range cfg.Files { | ||||
| 	for _, file := range cfgFiles { | ||||
| 		if !accept(file.Path) { | ||||
| 			continue | ||||
| 		} | ||||
| @ -52,7 +52,6 @@ func Files(cfg *config.Config, prefix string, filters ...string) error { | ||||
| 			content, | ||||
| 			mode, | ||||
| 			0755, | ||||
| 			cfg, | ||||
| 		) | ||||
|  | ||||
| 		if err != nil { | ||||
| @ -69,7 +68,7 @@ func Files(cfg *config.Config, prefix string, filters ...string) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func writeFile(log zerolog.Logger, path string, content []byte, fileMode, dirMode os.FileMode, cfg *config.Config) (err error) { | ||||
| func writeFile(log zerolog.Logger, path string, content []byte, fileMode, dirMode os.FileMode) (err error) { | ||||
| 	if err = os.MkdirAll(filepath.Dir(path), dirMode); err != nil { | ||||
| 		log.Error().Err(err).Msg("failed to create parent dir") | ||||
| 		return | ||||
|  | ||||
		Reference in New Issue
	
	Block a user