BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`.
(service string, dst any)
| 20 | |
| 21 | // BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`. |
| 22 | func BindSourcesToStructs(service string, dst any) error { |
| 23 | fileSystem := os.DirFS("/") |
| 24 | filePath := strings.TrimLeft(path.Join(defaults.BaseConfigPath(), service+".yaml"), "/") |
| 25 | return bindSourcesToStructs(fileSystem, filePath, service, dst) |
| 26 | } |
| 27 | |
| 28 | func bindSourcesToStructs(fileSystem fs.FS, filePath, service string, dst any) error { |
| 29 | cnf := gofig.NewWithOptions(service) |
no test coverage detected