feat(core): resolve declared configuration with env and file precedence

按 显式 env > autoEnable > 配置文件 > default 的优先级链解析每个已声明
key,支持标量 env 填充切片、duration 与结构体切片解码,非法 env 值不再
静默回退而是报 ErrConfigType。
This commit is contained in:
ryan
2026-08-29 09:38:39 +08:00
parent c77b5358e2
commit 4653afc554
4 changed files with 472 additions and 7 deletions
+7 -6
View File
@@ -138,12 +138,13 @@ type ConfigExtension interface {
// ConfigRegistry implements ConfigExtension. Declarations are additive; values are
// computed once by Resolve and reused by every later read.
type ConfigRegistry struct {
mu sync.RWMutex
src ConfigSource
decls map[string]*configDecl
order []string
values map[string]any
origins map[string]string
mu sync.RWMutex
src ConfigSource
decls map[string]*configDecl
order []string
values map[string]any
origins map[string]string
resolved bool
}
// NewConfigRegistry creates an empty configuration registry. A nil src is allowed so