Files
ConfigKit/README.md

2.6 KiB

ConfigKit

An opinionated Go library for applications that use YAML configuration files.

Linux is release-validated; macOS support is best-effort. See the platform support policy for details.

ConfigKit's initial loader accepts one strict YAML source (or explicit defaults-only input), optionally traverses explicit path and glob imports, strictly composes their disjoint definitions, applies typed defaults, and can overlay one selected fixed overlay and check an application schema version. It returns detached metadata and safe diagnostics. Applications may perform audited defaulting and normalization through a resolver, then report domain errors and warnings through read-only semantic validation. Secret tags and a path predicate drive deterministic redacted effective YAML. Typed secret references resolve environment names before validation, and explicit secrets-directory bootstrap is available as a separate startup operation. Explicit CLI override records apply above overlays. Value explanation is available through detached structured records and deterministic redacted output.

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
}

Design philosophy

ConfigKit favors one coherent, predictable configuration model over flexibility for reproducing each consumer's conventions. Its goal is to let applications load once, inspect where final values came from, and distinguish explicit values from omissions with minimal configuration bookkeeping. Applications retain their domain rules and execution responsibilities.

The architecture goals explain these priorities and how genuine new needs can justify extending the shared model. The deferred scope records deliberate exclusions.

The configuration contract describes implemented behavior. The consumer adoption guide provides maintained Narratio-, Notarius-, WeatherReporter-, and Seriatim-shaped examples and migration guidance. See the development guide for repository orientation and the release procedure for maintainer-only candidate and publication steps.

ConfigKit code is licensed under the LGPL v3.0 or later.

Open Source attribution notices are available.