nicholasjackson / env

Licence: other
Package to provide configuration as environment variables for 12 factor applications

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to env

Konfig
Simple config properties API for Kotlin
Stars: ✭ 249 (+703.23%)
Mutual labels:  environment-variables
Management
Management Endpoints used to allow insight into your applications
Stars: ✭ 31 (+0%)
Mutual labels:  environment-variables
easyappointments-docker
A docker image for Easy!Appointments
Stars: ✭ 20 (-35.48%)
Mutual labels:  environment-variables
dotenvy
Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents
Stars: ✭ 31 (+0%)
Mutual labels:  environment-variables
jsonargparse
Implement minimal boilerplate CLIs derived from type hints and parse from command line, config files and environment variables
Stars: ✭ 168 (+441.94%)
Mutual labels:  environment-variables
pytest-envvars
Pytest plugin to validate use of envvars on your tests
Stars: ✭ 21 (-32.26%)
Mutual labels:  environment-variables
Now Env
Use `now.json` environment variables while developing
Stars: ✭ 219 (+606.45%)
Mutual labels:  environment-variables
read-env
🔧 Transform environment variables into JSON object with sanitized values.
Stars: ✭ 60 (+93.55%)
Mutual labels:  environment-variables
envs
Easy access of environment variables from Python with support for typing (ex. booleans, strings, lists, tuples, integers, floats, and dicts). Now with CLI settings file converter.
Stars: ✭ 25 (-19.35%)
Mutual labels:  environment-variables
envclasses
envclasses is a library to map fields on dataclass object to environment variables.
Stars: ✭ 26 (-16.13%)
Mutual labels:  environment-variables
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+132.26%)
Mutual labels:  environment-variables
tfenv
Transform environment variables for use with Terraform (e.g. `HOSTNAME` ⇨ `TF_VAR_hostname`)
Stars: ✭ 120 (+287.1%)
Mutual labels:  environment-variables
envflag
Simple environment-variables extension to Golang flag.
Stars: ✭ 21 (-32.26%)
Mutual labels:  environment-variables
Go Env
a golang library to manage environment variables
Stars: ✭ 247 (+696.77%)
Mutual labels:  environment-variables
webpack-dotenv-plugin
Use dotenv with webpack.
Stars: ✭ 53 (+70.97%)
Mutual labels:  environment-variables
Cleanenv
✨Clean and minimalistic environment configuration reader for Golang
Stars: ✭ 245 (+690.32%)
Mutual labels:  environment-variables
sitri
Sitri - powerful settings & configs for python
Stars: ✭ 20 (-35.48%)
Mutual labels:  environment-variables
envyable
The simplest yaml to ENV config loader.
Stars: ✭ 78 (+151.61%)
Mutual labels:  environment-variables
tutorial-react-docker
Boilerplate React app in Docker container with ENV args
Stars: ✭ 63 (+103.23%)
Mutual labels:  environment-variables
config-cpp
C++ Configuration management library inspired by the Viper package for golang.
Stars: ✭ 21 (-32.26%)
Mutual labels:  environment-variables

Env

Env is a simple package providing configuration as environment variables for 12 factor applications, inspired by the Go flag package.

Basic usage

package main

var bindAddress = env.String("BIND_ADDRESS",true,"","bind address for server, i.e. localhost")
var bindPort = env.Integer("BIND_Port",true,0,"bind port for server, i.e. 9090")

func main() {
  err := env.Parse()
  if err != nil {
    fmt.Println(err.Error())
    os.Exit(1)
  }

  fmt.Println("bind address:", *bindAddress)
  fmt.Println("bind port:", *bindPort)
}

Showing help menu

Configuring an application with environment variables can be confusing to the user as often the configuration options are listed in the documentation rather than accessible from the command line like flag based configuration. Env has a built in help menu which can be accessed using the --help command line flag.

var bindAddress = env.String("BIND_ADDR", false, "localhost:9090", "Bind address for the server, i.e. localhost:9090")
var cacheURI = env.String("CACHE_URI", true, "", "URI for the cache server, i.e. localhost:9090")

func main() {
  err := env.Parse()
➜ BIND_PORT=9090 BIND_ADDRESS=localhost go run main.go --help
Configuration values are set using environment variables, for info please see the following list.

Environment variables:
  BIND_ADDRESS  default: no default
       bind address for server, i.e. localhost
  BIND_PORT  default: '0'
       bind port for server, i.e. 9090
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].