Viper

Viper

github.com

4

About this website

Viper is a complete configuration solution for Go applications, created by Steve Francia (spf13), the same developer behind Cobra (the Go CLI framework) and Hugo (the static site generator). Viper is designed to handle all aspects of application configuration, including finding, loading, unmarshaling, and merging configuration from multiple sources into a unified, type-safe configuration object. It is the most popular configuration library in the Go ecosystem, used by major Go projects including Docker, Kubernetes, Helm, and HashiCorp tools. Key features include: support for a wide range of configuration file formats including JSON, TOML, YAML, HCL, INI, properties, and env files, with automatic format detection based on file extension; the ability to set default values for configuration keys that are used when no other source provides a value; support for reading configuration from environment variables (with automatic prefix support, e.g., converting myapp.database.url to MYAPP_DATABASE_URL), command-line flags (via integration with pflag), remote key-value stores (etcd, Consul) for distributed configuration, and the ability to merge configurations from multiple sources with a defined precedence order (command-line flags override environment variables, which override config files, which override defaults); live watching and hot-reloading of configuration files (automatically re-reading the config file when it changes on disk, without restarting the application); deep nesting support with dot-notation key access (e.g., viper.GetString(database.host)); type-safe accessors (GetString, GetInt, GetBool, GetStringSlice, GetStringMap); and support for unmarshaling the entire configuration into a Go struct with mapstructure tags. As of 2026, Viper has over 27,000 GitHub stars.

Tags & Categories

Statistics

4
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!