golang-viper
CommunityConfigure Go apps with Viper in one place.
Authorkettleofketchup
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Go applications often need flexible configuration sources. Viper unifies reading from config files, environment variables, defaults, and remote stores, simplifying maintainable configuration management.
Core Features & Use Cases
- Unified config sources: read YAML/JSON/TOML files, bind environment variables, apply defaults, and support remote key/value stores.
- Environment prioritization and nested keys: overrides from env vars withPrefix and key replacers, mapping to nested Go structs.
- Easy integration: unmarshall into Go structs, watch for changes, and compose multiple config files for secrets or overrides.
Quick Start
- Create a config file (for example config.yaml) and place keys under server.host and server.port.
- In your Go code, initialize Viper with a config name and paths, set a config type if needed, load the config, and access values using viper.GetString("server.host") or viper.GetInt("server.port").
- Optional: enable environment variable overrides by setting a prefix and enabling AutomaticEnv, plus set defaults before reading in config.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: golang-viper Download link: https://github.com/kettleofketchup/dotfiles/archive/main.zip#golang-viper Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.