mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-10-08 20:03:05 -04:00
refactor(config): trim binder comments
This commit is contained in:
1 parent
44dba933b7
commit
895677deae
3 files changed
+2
-7
No files matched your search
@@ -1,5 +1,4 @@
|
||||
// Package binder binds OpenCloud yaml config files to config structs, as a leaf
|
||||
// package that avoids importing the aggregate service config in pkg/config.
|
||||
// Package binder binds yaml config files to config structs.
|
||||
package binder
|
||||
|
||||
import (
|
||||
@@ -42,8 +41,6 @@ func BindSourcesToStructsFS(fileSystem fs.FS, filePath, service string, dst any)
|
||||
|
||||
return err
|
||||
}
|
||||
// the error is ignored on purpose, matching the pre-extraction behavior:
|
||||
// an unparseable yaml file binds nothing instead of failing the startup
|
||||
_ = cnf.LoadSources("yaml", yamlContent)
|
||||
|
||||
err = cnf.BindStruct("", &dst)
|
||||
|
||||
@@ -14,8 +14,7 @@ type TestConfig struct {
|
||||
}
|
||||
|
||||
func TestBindSourcesToStructs(t *testing.T) {
|
||||
// setup test env: one var set to pin env expansion, two deliberately
|
||||
// unset to pin the defaults
|
||||
// setup test env
|
||||
t.Setenv("BINDER_TEST_SET_VAR", "from-env")
|
||||
yaml := `
|
||||
a: "${BINDER_TEST_SET_VAR|no-foo}"
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
)
|
||||
|
||||
// BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`.
|
||||
// The implementation lives in pkg/config/binder.
|
||||
func BindSourcesToStructs(service string, dst any) error {
|
||||
return binder.BindSourcesToStructs(service, dst)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user