viper-go-setup

Solid

Set up Viper for Go configuration management with file, env, and flag binding.

AI & Automation 1,160 stars 71 forks Updated today MIT

Install

View on GitHub

Quality Score: 94/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
56
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Viper Go Setup Set up Viper for Go configuration management. ## Generated Patterns ```go package config import ( "github.com/spf13/viper" "github.com/spf13/cobra" ) type Config struct { Server ServerConfig `mapstructure:"server"` Database DatabaseConfig `mapstructure:"database"` } type ServerConfig struct { Host string `mapstructure:"host"` Port int `mapstructure:"port"` } func InitConfig(cfgFile string) (*Config, error) { if cfgFile != "" { viper.SetConfigFile(cfgFile) } else { viper.SetConfigName("config") viper.SetConfigType("yaml") viper.AddConfigPath(".") viper.AddConfigPath("$HOME/.myapp") } viper.AutomaticEnv() viper.SetEnvPrefix("MYAPP") if err := viper.ReadInConfig(); err != nil { if _, ok := err.(viper.ConfigFileNotFoundError); !ok { return nil, err } } var cfg Config if err := viper.Unmarshal(&cfg); err != nil { return nil, err } return &cfg, nil } ``` ## Target Processes - configuration-management-system - cli-application-bootstrap

Details

Author
a5c-ai
Repository
a5c-ai/babysitter
Created
4 months ago
Last Updated
today
Language
JavaScript
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

cobra-viper

Expert skill for building CLI applications with Cobra and Viper, authored by spf13 — the original creator of both libraries. Covers command-first architecture, decoupled business logic, configuration management, environment variable binding, context-aware commands, and in-memory CLI testing. Use when building or reviewing any Go CLI application that uses Cobra and/or Viper.

1 Updated today
chafingdishposition355
AI & Automation Solid

cobra-scaffolder

Generate Cobra/Viper-based Go CLI applications with persistent flags, subcommands, and configuration management. Creates production-ready Go CLI with modern patterns.

1,160 Updated today
a5c-ai
AI & Automation Solid

golang-cli

Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli.

1,904 Updated 3 days ago
samber
AI & Automation Listed

golang-cli

Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli.

0 Updated today
guynhsichngeodiec
AI & Automation Listed

go-mod-helper

Go module system, dependency management, and project configuration assistance.

335 Updated today
aiskillstore