2026-12-05 16:32:03 +00:00
2026-11-17 15:48:53 +00:00
2026-11-17 15:48:53 +00:00

ConfigKit

ConfigKit loads YAML into your application's Go configuration type, combines the inputs you choose, and lets you inspect where the final values came from. You supply the types, defaults, and application rules; ConfigKit handles loading, combination, strict decoding, and inspection.

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

Load a configuration file

import "go.maximumdirect.net/configkit"

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
}

Existing consumers should follow the module-path migration guidance.

Add the features you need

Start with one file. Optional features use the same loading and inspection model:

The consumer guide walks through these tasks and links to maintained examples. The configuration reference defines the exact YAML, combination, and lifecycle rules.

Design philosophy

ConfigKit favors consistent, predictable rules across applications. A load returns the final configuration and metadata that distinguish supplied values such as false and 0 from omissions. Applications keep their domain rules and runtime initialization.

Within one layer, independent contributions combine strictly: conflicting values are errors. Across layers, higher-priority settings can replace lower-priority settings, while mappings combine by key. Identified lists have their declared combination rules. See the worked combination examples for the details and exceptions.

Loading finishes before the call returns. ConfigKit then stays inactive until you call it again; inspection uses saved load evidence. See completion and resource lifetime.

The architecture goals and ADRs explain design decisions, including shared import and inheritance ordering. Future work lists possible extensions. Contributors can start with the development guide; release maintainers use the release procedure.

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

Open Source attribution notices are available.

Description
An opinionated Go library for applications that use YAML configuration files.
Readme LGPL-3.0 16 MiB
2026-11-21 12:41:26 +00:00
Languages
Go 100%