All Projects → dmotylev → appconfig

dmotylev / appconfig

Licence: MIT license
Golang library for gathering configuration data from different sources

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to appconfig

cloud-native-hexagonal-node
A cloud native node microservice boilerplate based on the hexagonal architecture
Stars: ✭ 26 (+100%)
Mutual labels:  12-factor
sample-python-helper-aws-appconfig
A Python helper library for AWS AppConfig
Stars: ✭ 22 (+69.23%)
Mutual labels:  appconfig
envconfig-rs
Build a config structure from environment variables in Rust without boilerplate
Stars: ✭ 135 (+938.46%)
Mutual labels:  12-factor
gconfigs
gConfigs - Config and Secret parser
Stars: ✭ 42 (+223.08%)
Mutual labels:  12-factor
ts-dotenv
Strongly-typed environment variables for Node.js
Stars: ✭ 18 (+38.46%)
Mutual labels:  12-factor
metagraf
metaGraf is a opinionated specification for describing a software component and what its requirements are from the runtime environment. The mg command, turns metaGraf specifications into Kubernetes resources, supporting CI, CD and GitOps software delivery.
Stars: ✭ 15 (+15.38%)
Mutual labels:  12-factor
go-12factor-example
Example the 12factor app using golang
Stars: ✭ 20 (+53.85%)
Mutual labels:  12-factor
gryllidae
Opinionated CNCF-based, Docker Compose setup for everything needed to develop a 12factor app
Stars: ✭ 18 (+38.46%)
Mutual labels:  12-factor
configuro
An opinionated configuration loading framework for Containerized and Cloud-Native applications.
Stars: ✭ 81 (+523.08%)
Mutual labels:  12-factor
superconfig
Access environment variables. Also includes presence validation, type coercion and default values.
Stars: ✭ 33 (+153.85%)
Mutual labels:  12-factor
phd5-app
💜 Universal web application built upon Docker, PHP & Yii 2.0 Framework
Stars: ✭ 71 (+446.15%)
Mutual labels:  12-factor
vyper
Python configuration with (more) fangs
Stars: ✭ 121 (+830.77%)
Mutual labels:  12-factor

AppConfig Build Status Coverage Status Go Report Card GoDoc

import "github.com/dmotylev/appconfig"

Documentation

See GoDoc.

Usage

Set environment variables:

APP_TIMEOUT=1h2m3s
APP_WORKERNAME=Monkey

Write other values to the file:

cat > local.conf << EOF
APP_TIMEOUT=2h2m3s
APP_NUMWORKERS=10
APP_WORKERNAME=Robot
EOF

Write code:

Populate variable from both sources:

package main

import (
	"fmt"
	"time"

	"github.com/dmotylev/appconfig"
)

func main() {
	var conf struct {
		Timeout    time.Duration
		Day        time.Time `time,format:"2006-01-02"`
		WorkerName string
		NumWorkers int
	}

	err := appconfig.Load(&conf, appconfig.FromEnv("APP_"), appconfig.FromFile("local.conf"))

	fmt.Printf("err=%v\n", err)
	fmt.Printf("timeout=%s\n", conf.Timeout)
	fmt.Printf("day=%s\n", conf.Day.Format(time.UnixDate))
	fmt.Printf("worker=%s\n", conf.WorkerName)
	fmt.Printf("workers=%d\n", conf.NumWorkers)
}

Results:

err=<nil>
timeout=1h2m3s
day=Fri Dec 13 00:00:00 UTC 2013
worker=Monkey
workers=10

Get some inspiration from tests.

License

The package available under LICENSE.

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].