Configuration

67 projects

Configuration libraries load settings from files, environment variables, flags and remote stores into your program, usually by filling a struct. They differ in scope: some only parse environment variables into tagged structs, others merge several sources with precedence rules, watch files for changes and support many formats. The standard library offers flag and os.Getenv, plus encoding/json, but no YAML or TOML parser.

spf13/viper is the most widely used, supporting JSON, TOML, YAML, env vars, flags through pflag and live reloading; its breadth also brings a larger dependency tree. knadh/koanf covers similar ground with a modular design where providers and parsers are separate modules, so you only pull in what you use. caarlos0/env and kelseyhightower/envconfig parse environment variables into structs with defaults, which fits twelve-factor apps. cleanenv reads files and environment together, godotenv loads .env files, go-ini handles INI, and adrg/xdg finds the right config directories on each OS. alecthomas/kong is a CLI parser that can also load config files.

For containerized services configured through the environment, caarlos0/env with a struct is often enough and easy to test. Choose koanf or viper when you merge files, flags and environment with precedence rules. Whatever you pick, load configuration once at startup into a typed struct and validate it there, rather than reading keys throughout the code.

viperby spf13

Go configuration with fangs.

github.com/spf13/viperGo 1.23+ 10 dependenciesv1.21.0updated 9mo ago

30.5k

godotenvby joho

Go port of Ruby's dotenv library (Loads environment variables from.env).

github.com/joho/godotenvGo 1.13+ No dependencies v1.5.1updated 3mo ago

10.7k

sonicby bytedance

A blazingly fast JSON serializing & deserializing library.

github.com/bytedance/sonicGo 1.18+ 8 dependenciesv1.15.5updated 6d ago

9.6k

envby caarlos0

Parse environment variables to Go structs (with defaults).

github.com/caarlos0/env/v11Go 1.26+ No dependencies v11.4.1updated 1d ago

6.4k

kelseyhightower/envconfigby kelseyhightower

Go library for managing configuration data from environment variables.

github.com/kelseyhightower/envconfigGo 1.20+ No dependencies v1.4.0updated 1y ago

5.5k

koanfby knadh

Light weight, extensible library for reading config in Go applications. Built in support for JSON, TOML, YAML, env, command line.

github.com/knadh/koanf/v2Go 1.23+ 3 dependenciesv2.4.1updated today

4.2k

iniby go-ini

Go package to read and write INI files.

gopkg.in/ini.v1Go 1.13+ 1 dependencyv1.67.3updated 1mo ago

3.5k

kongby alecthomas

Command-line parser with support for arbitrarily complex command-line structures and additional sources of configuration such as YAML, JSON, TOML, etc (successor to kingpin).

github.com/alecthomas/kongGo 1.20+ 2 dependenciesupdated 1d ago

3.2k

cleanenvby ilyakaznacheev

Minimalistic configuration reader (from files, ENV, and wherever you want).

github.com/ilyakaznacheev/cleanenvGo 1.13+ 4 dependenciesv1.5.0updated 1y ago

2.2k

xdgby adrg

Go implementation of the XDG Base Directory Specification and XDG user directories.

github.com/adrg/xdgGo 1.25+ 2 dependenciesv0.5.3updated 7d ago

1k

aconfigby cristalhq

Simple, useful and opinionated config loader.

github.com/cristalhq/aconfigGo 1.18+ 1 dependencyv0.19.0updated 11mo ago

654

konfigby lalamove

Composable, observable and performant config handling for Go for the distributed processing era.

github.com/lalamove/konfigGo 1.14+ 20 dependenciesv0.8.3updated 6y ago

646

gookit/configby gookit

Application config manage(load,get,set). support JSON, YAML, TOML, INI, HCL. multi file load, data override merge.

github.com/gookit/config/v2Go 1.21+ 9 dependenciesv2.2.9updated 2d ago

585

confitaby heetch

Load configuration in cascade from multiple backends into a struct.

github.com/heetch/confitaGo 1.23+ 8 dependenciesv0.11.0updated 7mo ago

506

konfby nil-go

The simplest API for reading/watching config from file, env, flag and clouds (e.g. AWS, Azure, GCP).

github.com/nil-go/konfGo 1.24+ No dependencies v1.5.0updated today

397

figby kkyr

Tiny library for reading configuration from a file and from environment variables (with validation & defaults).

github.com/kkyr/figGo 1.21+ 3 dependenciesv0.4.0updated 1y ago

383

GoLobby/Configby golobby

GoLobby Config is a lightweight yet powerful configuration manager for the Go programming language.

github.com/golobby/config/v3Go 1.16+ 5 dependenciesv3.4.2updated 3y ago

366

hjson

Human JSON, a configuration file format for humans. Relaxed syntax, fewer mistakes, more comments.

github.com/hjson/hjson-go/v4Go 1.12+ No dependencies v4.7.1updated 1d ago

359

configby JeremyLoy

Cloud native application configuration. Bind ENV to structs in only two lines.

github.com/JeremyLoy/configGo 1.27+ No dependencies v1.5.0updated 21d ago

336

envconfigby vrischmann

Read your configuration from environment variables.

github.com/vrischmann/envconfigGo 1.13+ 1 dependencyupdated 1y ago

249

zerocfgby chaindead

Zero-effort, concise configuration management that avoids boilerplate and repetitive code, supports multiple sources with priority overrides.

github.com/chaindead/zerocfgGo 1.20+ 2 dependenciesupdated 3mo ago

200

argusby agilira

File watching and configuration management with MPSC ring buffer, adaptive batching strategies, and universal format parsing (JSON, YAML, TOML, INI, HCL, Properties).

github.com/agilira/argusGo 1.25+ 5 dependenciesv1.7.5updated today

169

harvesterby beatlabs

Harvester, a easy to use static and dynamic configuration package supporting seeding, env vars and Consul integration.

github.com/beatlabs/harvesterGo 1.26+ 4 dependenciesv0.20.0updated 1d ago

132

onionby goraz

Layer based configuration for Go, Supports JSON, TOML, YAML, properties, etcd, env, and encryption using PGP.

github.com/goraz/onionGo 1.17+ 10 dependenciesupdated 3y ago

119

configurationby BoRuDar

Library for initializing configuration structs from env variables, files, flags and 'default' tag.

github.com/BoRuDar/configuration/v5Go 1.22+ No dependencies v5.0.1updated 1y ago

108

envhby antham

Helpers to manage environment variables.

github.com/antham/envhGo 1.18+ 2 dependenciesv1.5.0updated 2mo ago

101

configuroby sherifabdlnaby

Opinionated configuration loading & validation framework from ENV and Files focused towards 12-Factor compliant applications.

github.com/sherifabdlnaby/configuro8 dependenciesv0.0.3updated 3mo ago

92

hoconby gurkankaymak

Configuration library for working with the HOCON(a human-friendly JSON superset) format, supports features like environment variables, referencing other values, comments and multiple files.

github.com/gurkankaymak/hoconGo 1.17+ No dependencies v1.4.1updated 16d ago

91

envby junk1tm

A lightweight package for loading environment variables into structs.

go-simpler.org/envGo 1.20+ No dependencies v0.12.0updated 2y ago

81

uConfigby omeid

Lightweight, zero-dependency, and extendable configuration management.

github.com/omeid/uconfigGo 1.22+ 3 dependenciesupdated 4mo ago

75

go-aws-ssmby PaddleHQ

Go package that fetches parameters from AWS System Manager - Parameter Store.

github.com/PaddleHQ/go-aws-ssmGo 1.25+ 2 dependenciesv0.12.1updated 8d ago

67

configby num30

Configure your app using file, environment variables, or flags in two lines of code.

github.com/num30/configGo 1.19+ 7 dependenciesv0.1.3updated 1y ago

61

gone/jconfby One-com

Modular JSON configuration. Keep your config structs along with the code they configure and delegate parsing to submodules without sacrificing full config serialization.

updated 5y ago

51

go-cfgby dsbasko

The library provides a unified way to read configuration data into a structure from various sources, such as env, flags, and configuration files (.json,.yaml,.toml,.env).

github.com/dsbasko/go-cfgGo 1.18+ 6 dependenciesv1.2.0updated 2y ago

50

goconfigby fulldump

Populate Go structs from flags, environment variables, config.json and defaults with deterministic precedence. No extra dependencies.

github.com/fulldump/goconfigGo 1.20+ No dependencies v1.9.0updated 4mo ago

49

genvby sakirsensoy

Read environment variables easily with dotenv support.

github.com/sakirsensoy/genvGo 1.12+ No dependencies v1.2.0updated 9mo ago

45

go-upby ufoscout

A simple configuration library with recursive placeholders resolution and no magic.

github.com/ufoscout/go-upGo 1.13+ 1 dependencyupdated 6y ago

43

confiqby greencoda

Structured data format to config struct decoder library for Go - supporting multiple data formats.

github.com/greencoda/confiqGo 1.22+ 4 dependenciesv1.3.3updated 6mo ago

39

enflagby atelpis

Container-oriented, zero-dependency configuration library that unifies Env variable and Flag parsing. Uses generics for type safety, without reflection or struct tags.

github.com/atelpis/enflagGo 1.18+ No dependencies v0.3.0updated 1y ago

39

conflateby the4thamigo-uk

Library/tool to merge multiple JSON/YAML/TOML files from arbitrary URLs, validation against a JSON schema, and application of default values defined in the schema.

github.com/the4thamigo-uk/conflateGo 1.14+ 6 dependenciesv1.0.1updated 3y ago

36

bclby wkhere

BCL is a configuration language similar to HCL.

github.com/wkhere/bclGo 1.21+ 2 dependenciesupdated 4d ago

34

go-arrayby deatil

A Go package that read or set data from map, slice or json.

github.com/deatil/go-arrayGo 1.25+ No dependencies v1.0.3000updated 4mo ago

23

go-ssm-configby ianlopshire

Go utility for loading configuration parameters from AWS SSM (Parameter Store).

github.com/ianlopshire/go-ssm-configGo 1.11+ 2 dependenciesv1.0.2updated 3y ago

23

envyamlby yuseferi

Yaml with environment variables reader. it helps to have secrets as environment variable but load them configs as structured Yaml.

github.com/yuseferi/envyamlGo 1.25+ 3 dependenciesv1.1.0updated 6mo ago

22

nasermirzaei89/envby nasermirzaei89

Simple useful package for read environment variables.

github.com/nasermirzaei89/envGo 1.21+ No dependencies v1.8.0updated 5mo ago

22

yamagiconfby romshark

The "safe subset" of YAML for Go configs.

github.com/romshark/yamagiconfGo 1.26+ 3 dependenciesv1.1.2updated 21d ago

19

go-iniby subpop

A Go package that marshals and unmarshals INI-files.

github.com/subpop/go-iniGo 1.21+ 1 dependencyupdated 3mo ago

18

iniby wlevene

INI Parser & Write Library, Unmarshal to Struct, Marshal to Json, Write File, watch file.

github.com/wlevene/iniGo 1.16+ 1 dependencyv0.1.5updated 2mo ago

17

go-confby ThomasObenaus

Simple library for application configuration based on annotated structs. It supports reading the configuration from environment variables, config files and command line parameters.

github.com/ThomasObenaus/go-confGo 1.23+ 8 dependenciesv0.1.0updated 1y ago

14

nfigureby muir

Per-library struct-tag based configuration from command lines (Posix & Go-style); environment, JSON, YAML

github.com/muir/nfigureGo 1.23+ 8 dependenciesv0.9.0updated 3d ago

12

typenvby diegomarangoni

Minimalistic, zero dependency, typed environment variables library.

diegomarangoni.dev/typenvGo 1.18+ 1 dependencyv1.2.0updated 1y ago

12

piperby Yiling-J

Viper wrapper with config inheritance and key generation.

github.com/Yiling-J/piperGo 1.16+ 3 dependenciesv0.1.1updated 4y ago

10

go-yamlvalidatorby Yakwilik

Source-aware YAML validation with native Go schemas and JSON Schema support.

github.com/Yakwilik/go-yamlvalidatorGo 1.24+ 6 dependenciesv1.1.0updated 16d ago

9

gonfigby milad-abbasi

Tag-based configuration parser which loads values from different providers into typesafe struct.

github.com/miladabc/gonfigGo 1.15+ 4 dependenciesv0.9.1updated 5y ago

9

envby syntaqx

An environment utility package with support for unmarshaling into structs.

github.com/syntaqx/envGo 1.24+ No dependencies v0.2.5updated 27d ago

8

hedzr/storeby hedzr

Extensible, high-performance configuration management library, optimized for hierarchical data.

github.com/hedzr/storeGo 1.26+ 4 dependenciesv1.4.9updated 2d ago

8

swapby oblq

Instantiate/configure structs recursively, based on build environment. (YAML, TOML, JSON and env).

github.com/oblq/swapGo 1.14+ 3 dependenciesupdated 1y ago

8

azureappconfigurationby Azure

The configuration provider for consuming data in Azure App Configuration from Go applications.

updated 1mo ago

6

go-configby MordaTeam

Simple and convenient library for working with app configurations.

github.com/MordaTeam/go-configGo 1.24+ 9 dependenciesv1.4.0updated 8mo ago

6

GoCfgby Jagerente

Config manager with Struct Tags based contracts, custom value providers, parsers, and documentation generation. Customizable yet simple.

github.com/Jagerente/gocfgGo 1.21+ 2 dependenciesv1.1.0updated 2mo ago

6

go-external-config

Spring-inspired configuration management library for Go.

github.com/go-external-config/goGo 1.26+ 6 dependenciesv1.0.49updated 2d ago

2

go-external-config/awsby go-external-config

AWS property source support for go-external-config.

github.com/go-external-config/awsGo 1.26+ 7 dependenciesv1.0.9updated 2mo ago

1

go-external-config/consulby go-external-config

Consul property source support for go-external-config.

github.com/go-external-config/consulGo 1.26+ 4 dependenciesv1.0.6updated 2mo ago

1

go-external-config/vaultby go-external-config

Vault property source support for go-external-config.

github.com/go-external-config/vaultGo 1.26+ 4 dependenciesv1.0.9updated 2mo ago

1

configby andreiavrammsd

Struct-based configuration loader with a dedicated config file parser, supporting env vars, flags, defaults, and validation.

github.com/andreiavrammsd/configGo 1.23+ No dependencies v0.7.1updated 13d ago

0

goenvby psyb0t

Reads the ENV environment variable and reports whether the process is running in production or development.

github.com/psyb0t/goenvGo 1.26+ No dependencies v1.0.11updated 7d ago

0

gonfigurationby psyb0t

Loads configuration from environment variables into structs via reflection, with struct-tag defaults and required fields.

github.com/psyb0t/gonfigurationGo 1.26+ 2 dependenciesv1.6.4updated 7d ago

0
Esc

Type to search every entry. ↑↓ to move, Enter to open.