Document and demonstrate native and layered configuration loading
This commit is contained in:
11
layered.go
11
layered.go
@@ -26,10 +26,13 @@ type LayeredOptions[T any] struct {
|
||||
Overrides []Override
|
||||
}
|
||||
|
||||
// LoadLayered acquires the main input first, strictly composes each underlay,
|
||||
// then applies underlays in order beneath main, a selected overlay, and CLI
|
||||
// overrides. It performs defaults, decoding, resolution, and validation once.
|
||||
// Zero or one options value is accepted; any error returns a nil result.
|
||||
// LoadLayered acquires the main input first and strictly composes enabled
|
||||
// imports with each input's tier. It strictly composes contributions within
|
||||
// each underlay, then recursively combines underlays in listed order beneath
|
||||
// main, a selected overlay, and CLI overrides. Defaults, decoding, resolution,
|
||||
// and validation run once on the assembled input. Source IDs follow acquisition
|
||||
// order, not precedence order. Zero or one options value is accepted; any error
|
||||
// returns a nil result.
|
||||
func LoadLayered[T any](main Input, supplied ...LayeredOptions[T]) (*Result[T], error) {
|
||||
options := make([]engine.LayeredOptions[T], len(supplied))
|
||||
for index := range supplied {
|
||||
|
||||
Reference in New Issue
Block a user