A lightweight, extensible configuration management library for Go with support for multiple sources and formats.
Koanf is a configuration management library for Go applications that reads settings from various sources like files, environment variables, command line flags, and remote services such as S3 and Vault. It supports multiple formats including JSON, YAML, TOML, and HCL, and is designed as a cleaner, more modular alternative to viper.
Go developers building applications that require flexible configuration management from multiple sources, especially those seeking a lightweight and extensible alternative to viper.
Developers choose Koanf for its clean abstractions, minimal dependencies, and extensibility through a provider-parser interface, avoiding the tight coupling and bloat found in some alternatives. It offers live reloading, flexible merging strategies, and case-sensitive key handling without imposing arbitrary ordering conventions.
Simple, extremely lightweight, extensible, configuration management library for Go. Supports JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses simple Provider and Parser interfaces, making it easy to extend with custom sources and formats, as emphasized in the Concepts section and custom provider examples.
Core library is lightweight with optional, separate installations for providers and parsers, reducing build size compared to alternatives like viper.
Supports watching files for changes and triggering automatic reloads via the Watch() method, demonstrated in the 'Watching file for changes' section with file and other providers.
Allows custom merge functions and strict merging to prevent accidental type overrides, with configurable behavior detailed in 'Merge behavior' and 'Custom merge strategies'.
Each provider and parser requires individual go get commands, adding setup complexity compared to monolithic libraries where everything is bundled.
Config keys are strictly case-sensitive, which can lead to errors if users or systems expect case-insensitive behavior, as stated in the 'Order of merge and key case sensitivity' section.
When merging config from different formats like JSON and YAML, strict merge can fail due to type differences (e.g., integers vs. floats), a known issue highlighted in the README's merge notes.
koanf is an open-source alternative to the following products: