Koanf

Koanf

github.com

1

About this website

Koanf is a lightweight, extensible configuration management library for Go, created by Kailash Nadh (knadh) who is also the creator of the popular ListMonk newsletter software. With over 3,000 stars as of 2026, Koanf provides a simple, unified API for loading, merging, and watching configuration from multiple sources, eliminating the boilerplate typically required for configuration management in Go applications. Unlike Viper (the most popular Go config library), Koanf is designed to be simpler, more modular, and without the heavy dependencies. Key features include: provider-based loading from multiple sources (file providers for JSON, YAML, TOML, HCL, INI, ENV, and Java properties formats, environment variable provider with custom prefixes and delimiters, command-line flag provider via Go flag or pflag, S3 provider, HashiCorp Vault provider, Consul provider, and etcd provider), automatic merging of configuration from all providers (with later providers overriding earlier ones for the same keys), nested key access using dot notation (e.g., app.server.port), type-safe accessors (GetInt, GetString, GetBool, GetFloat64, GetDuration, GetStrings, GetInts), struct unmarshalling via mapstructure or custom decoders with support for struct tags, configuration watching with callbacks (re-loading configuration when files change), environment variable expansion (expanding $VAR in values), key delimiters customization, nested map support, default value setting, and a merge strategy control (choosing how arrays and maps are merged from multiple sources). Koanf is licensed under MIT.

Tags & Categories

Categories

Tags

Statistics

1
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!