Skip to content

JaredReisinger/asp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asp — Automatic Settings Processor

Go reference Go version GitHub build Codecov License

asp, the Automatic Settings Provider, an opinionated companion for viper and cobra.

Why does this exist?

The cobra package provides excellent command-line flag functionality, and viper provides a rich configuration store and environment variable binding… but… there’s a lot of boilerplate and redundant code if you want to achieve the nirvana of CLI flags and environment variables and configuration file support for all flags/settings in your application. The asp package attempts to reduce this boilerplate by capturing it all from your “canonical” configure structure definition.

The goals of asp are to

  1. reduce the redundant boilerplate by concisely defining all of the necessary information in the config struct itself;

  2. encourage good practices by ensuring that every option has config, command-line and environment variable representation;

  3. avoid possible typos that using string-based configuration lookups can cause—Go can’t tell that viper.Get("sommeSetting") is misspelled at compile time—but it can tell that config.sommeSetting is invalid if the struct defines the member as config.someSetting.

About

asp, the Automatic Settings Provider, an opinionated companion for `viper` and `cobra`.

Topics

Resources

License

Stars

Watchers

Forks

Contributors