Add single-source loading and version checks
This commit is contained in:
25
README.md
25
README.md
@@ -2,9 +2,28 @@
|
||||
|
||||
An opinionated Go library for applications that use YAML configuration files.
|
||||
|
||||
ConfigKit is in early implementation. The Go module and root package boundary are
|
||||
established, but no usable configuration loader has been implemented yet.
|
||||
ConfigKit is in early implementation. Its current loader accepts one strict YAML
|
||||
source (or explicit defaults-only input), applies typed defaults, optionally checks
|
||||
an application schema version, and returns detached metadata and safe diagnostics.
|
||||
Composition, profiles, application callbacks, overrides, secrets, and rendering are
|
||||
still under development.
|
||||
|
||||
The [initial target design](docs/roadmap/initial.md) describes planned behavior.
|
||||
```go
|
||||
type Config struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
Workers int `yaml:"workers"`
|
||||
}
|
||||
|
||||
func ReadConfig(path string) (Config, error) {
|
||||
result, err := configkit.Load[Config](configkit.File(path))
|
||||
if err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
return result.Config, nil
|
||||
}
|
||||
```
|
||||
|
||||
The [configuration contract](docs/config.md) describes implemented behavior. The
|
||||
[initial target design](docs/roadmap/initial.md) describes planned behavior.
|
||||
The [implementation plan](docs/roadmap/implementation.md) owns the pending stages.
|
||||
See the [development guide](docs/development.md) for repository orientation.
|
||||
|
||||
Reference in New Issue
Block a user