All Projects → joshbetz → Config

joshbetz / Config

Licence: mit
🛠 A configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Config

Node Convict
Featureful configuration management library for Node.js
Stars: ✭ 1,855 (+813.79%)
Mutual labels:  config, environment-variables, json, configuration
goodconf
Transparently load variables from environment or JSON/YAML file.
Stars: ✭ 80 (-60.59%)
Mutual labels:  config, configuration, environment-variables
Fig
A minimalist Go configuration library
Stars: ✭ 142 (-30.05%)
Mutual labels:  environment-variables, json, configuration
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+273.89%)
Mutual labels:  config, json, configuration
superconfig
Access environment variables. Also includes presence validation, type coercion and default values.
Stars: ✭ 33 (-83.74%)
Mutual labels:  config, configuration, environment-variables
climatecontrol
Python library for loading settings and config data from files and environment variables
Stars: ✭ 20 (-90.15%)
Mutual labels:  config, configuration, environment-variables
Jsonnet
Jsonnet - The data templating language
Stars: ✭ 5,257 (+2489.66%)
Mutual labels:  config, json, configuration
Konf
A type-safe cascading configuration library for Kotlin/Java/Android, supporting most configuration formats
Stars: ✭ 225 (+10.84%)
Mutual labels:  config, json, configuration
Mconfig
MCONFIG is a lightweight Golang library for integrating configs files like (json, yml, toml) and environment variables into one config struct.
Stars: ✭ 28 (-86.21%)
Mutual labels:  config, environment-variables, json
Env
Simple lib to parse environment variables to structs
Stars: ✭ 2,164 (+966.01%)
Mutual labels:  environment-variables, config, configuration
Dynaconf
Configuration Management for Python ⚙
Stars: ✭ 2,082 (+925.62%)
Mutual labels:  config, environment-variables, configuration
Simple Settings
A simple way to manage your project settings.
Stars: ✭ 165 (-18.72%)
Mutual labels:  config, json, configuration
read-env
🔧 Transform environment variables into JSON object with sanitized values.
Stars: ✭ 60 (-70.44%)
Mutual labels:  config, configuration, environment-variables
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (-57.64%)
Mutual labels:  config, configuration, environment-variables
sitri
Sitri - powerful settings & configs for python
Stars: ✭ 20 (-90.15%)
Mutual labels:  config, configuration, environment-variables
env
A lightweight package for loading OS environment variables into structs for Go projects
Stars: ✭ 24 (-88.18%)
Mutual labels:  config, configuration, environment-variables
Environ Config
Python Application Configuration With Environment Variables
Stars: ✭ 210 (+3.45%)
Mutual labels:  config, environment-variables, configuration
Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (+350.74%)
Mutual labels:  config, json, configuration
Config
A lightweight yet powerful config package for Go projects
Stars: ✭ 126 (-37.93%)
Mutual labels:  config, environment-variables, configuration
Aconfig
Simple, useful and opinionated config loader.
Stars: ✭ 187 (-7.88%)
Mutual labels:  config, environment-variables, configuration

config

Build Status Go Report Card

A small configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP.

Example

func main() {
	c := config.New("config.json")

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		var value string
		c.Get("value", &value)
		fmt.Fprintf(w, "Value: %s", value)
	})

	http.ListenAndServe(":3000", nil)
}

Reload config on SIGHUP

API

func New(file string) *Config

Constructor that initializes a Config object and sets up the SIGHUP watcher.

func (config *Config) Get(key string, v interface{}) error

Takes the path to a JSON file, the name of the configuration option, and a pointer to the variable where the config value will be stored. v can be a pointer to a string, bool, or float64.

func (config *Config) Reload()

Reloads the config. Happens automatically on SIGHUP.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].