Simple, useful and opinionated config loader.
Alternatives To Aconfig
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
30 Days Of Javascript36,456
2 days ago1January 25, 2022253JavaScript
30 days of JavaScript programming challenge is a step-by-step guide to learn JavaScript programming language in 30 days. This challenge may take more than 100 days, please just follow your own pace. These videos may help too:
Httpie27,8561,6454217 days ago55May 06, 2022146bsd-3-clausePython
🥧 HTTPie for Terminal — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
Cli20,2523,0703,59421 hours ago137September 11, 202239mitGo
A simple, fast, and fun package for building command line apps in Go
Fx16,2831116a month ago47September 15, 202022mitGo
Terminal JSON viewer
Yq8,75143a day ago10February 06, 202076mitGo
yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor
Http Prompt8,717712 months ago24March 05, 202153mitPython
An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more.
17 hours ago96August 25, 202243otherGo
jq for binary formats - tool, language and decoders for working with binary and text formats
4 days ago64March 31, 202293otherGo
Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
Structured Text Tools6,672
2 months ago15
A list of command line tools for manipulating structured text data
Visidata6,6095521 hours ago48December 16, 202187gpl-3.0Python
A terminal spreadsheet multitool for discovering and arranging data
Alternatives To Aconfig
Select To Compare

Alternative Project Comparisons


build-img pkg-img version-img

Simple, useful and opinionated config loader.


There are many solutions regarding configuration loading in Go. I was looking for a simple loader that is as easy to use and understand as possible. The goal was to load config from 4 places: defaults (in the code), files, environment variables, command-line flags. This library works with all of these sources.


  • Simple API.
  • Clean and tested code.
  • Automatic fields mapping.
  • Supports different sources:
    • defaults in the code
    • files (JSON, YAML, TOML, DotENV, HCL)
    • environment variables
    • command-line flags
  • Dependency-free (file parsers are optional).
  • Ability to walk over configuration fields.


Go version 1.14+

go get


type MyConfig struct {
	Port int `default:"1111" usage:"just give a number"`
	Auth struct {
		User string `required:"true"`
		Pass string `required:"true"`
	Pass string `default:"" env:"SECRET" flag:"sec_ret"`

var cfg MyConfig
loader := aconfig.LoaderFor(&cfg, aconfig.Config{
	// feel free to skip some steps :)
	// SkipDefaults: true,
	// SkipFiles:    true,
	// SkipEnv:      true,
	// SkipFlags:    true,
	EnvPrefix:       "APP",
	FlagPrefix:      "app",
	Files:           []string{"/var/opt/myapp/config.json", "ouch.yaml"},
	FileDecoders: map[string]aconfig.FileDecoder{
		// from `aconfigyaml` submodule
		// see submodules in repo for more formats
		".yaml": aconfigyaml.New(),

// IMPORTANT: define your own flags with `flagSet`
flagSet := loader.Flags()

if err := loader.Load(); err != nil {

// configuration fields will be loaded from (in order):
// 1. defaults set in structure tags (see MyConfig defenition)
// 2. loaded from files `file.json` if not `ouch.yaml` will be used
// 3. from corresponding environment variables with the prefix `APP_`
// 4. command-line flags with the prefix `app.` if they are

Also see examples: examples_test.go.

Integration with spf13/cobra playground.


See these docs.


MIT License.

Popular Command Line Projects
Popular Json Projects
Popular Command Line Interface Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Command Line
Environment Variables