aconfig alternatives and similar packages
Based on the "Configuration" category.
Alternatively, view aconfig alternatives based on common mentions on social networks and blogs.
-
kelseyhightower/envconfig
Golang library for managing configuration data from environment variables -
env
A simple and zero-dependencies library to parse environment variables into structs -
koanf
Simple, extremely lightweight, extensible, configuration management library for Go. Support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper. -
cleanenv
✨Clean and minimalistic environment configuration reader for Golang -
konfig
Composable, observable and performant config handling for Go for the distributed processing era -
confita
Load configuration in cascade from multiple backends into a struct -
gookit/config
📝 Go configuration manage(load,get,set,export). support JSON, YAML, TOML, Properties, INI, HCL, ENV and Flags. Multi file load, data override merge, parse ENV var. Go应用配置加载管理,支持多种格式,多文件加载,远程文件加载,支持数据合并,解析环境变量名 -
GoLobby/Config
A lightweight yet powerful configuration manager for the Go programming language -
envconfig
Small library to read your configuration from environment variables -
gcfg
read INI-style configuration files into Go structs; supports user-defined types and subsections -
goConfig
goconfig uses a struct as input and populates the fields of this struct with parameters from command line, environment variables and configuration file. -
joshbetz/config
🛠 A configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP. -
configuro
An opinionated configuration loading framework for Containerized and Cloud-Native applications. -
configuration
Library for setting values to structs' fields from env, flags, files or default tag -
hocon
go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config -
configure
Configure is a Go package that gives you easy configuration of your project through redundancy -
uConfig
Lightweight, zero-dependency, and extendable configuration management library for Go -
go-up
go-up! A simple configuration library with recursive placeholders resolution and no magic. -
CONFLATE
Library providing routines to merge and validate JSON, YAML and/or TOML files -
go-ssm-config
Go utility for loading configuration parameters from AWS SSM (Parameter Store) -
Genv
Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file. -
subVars
Substitute environment variables from command line for template driven configuration files. -
swap
Instantiate/configure structs recursively, based on build environment. (YAML, TOML, JSON and env).
Collect and Analyze Billions of Data Points in Real Time
Do you think we are missing an alternative of aconfig or a related project?
Popular Comparisons
README
aconfig
[![build-img]][build-url] [![pkg-img]][pkg-url] [![reportcard-img]][reportcard-url] [![coverage-img]][coverage-url] [![version-img]][version-url]
Simple, useful and opinionated config loader.
Rationale
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.
Features
- 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.
Install
Go version 1.14+
go get github.com/cristalhq/aconfig
Example
type MyConfig struct {
Port int `default:"1111" usage:"just give a number"`
Auth struct {
User string `default:"def-user"`
Pass string `default:"def-pass"`
}
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 {
panic(err)
}
// 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.
Documentation
See [these docs][pkg-url].
License
[MIT License](LICENSE).
[build-img]: https://github.com/cristalhq/aconfig/workflows/build/badge.svg [build-url]: https://github.com/cristalhq/aconfig/actions [pkg-img]: https://pkg.go.dev/badge/cristalhq/aconfig [pkg-url]: https://pkg.go.dev/github.com/cristalhq/aconfig [reportcard-img]: https://goreportcard.com/badge/cristalhq/aconfig [reportcard-url]: https://goreportcard.com/report/cristalhq/aconfig [coverage-img]: https://codecov.io/gh/cristalhq/aconfig/branch/master/graph/badge.svg [coverage-url]: https://codecov.io/gh/cristalhq/aconfig [version-img]: https://img.shields.io/github/v/release/cristalhq/aconfig [version-url]: https://github.com/cristalhq/aconfig/releases
*Note that all licence references and agreements mentioned in the aconfig README section above
are relevant to that project's source code only.