MCPcopy Index your code
hub / github.com/opencloud-eu/opencloud / BindSourcesToStructs

Function BindSourcesToStructs

pkg/config/helpers.go:22–26  ·  view source on GitHub ↗

BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`.

(service string, dst any)

Source from the content-addressed store, hash-verified

20
21// BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`.
22func 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
28func bindSourcesToStructs(fileSystem fs.FS, filePath, service string, dst any) error {
29 cnf := gofig.NewWithOptions(service)

Callers 1

ParseConfigFunction · 0.92

Calls 2

BaseConfigPathFunction · 0.92
bindSourcesToStructsFunction · 0.85

Tested by

no test coverage detected