Skip to content

TrackMaven/etcd3env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

etcd3env

etcd3env provides a wrapper around a given process that will populate its environment variables from a given etcd server using the etcd v3 API.

Installation

You can just download the binary from the command line:

  • Linux
curl -sL https://github.com/trackmaven/etcd3env/releases/download/v1.0.0/etcd3env-linux-amd64-1.0.0 > etcd3env

If you would prefer compile the binary (assuming buildtools and Go are installed) :

git clone git@github.com:trackmaven/etcd3env.git
cd etcd3env
go get github.com/tools/godep
GOPATH=`pwd`/Godeps/_workspace go build -o etcd3env .

Usage

Options

Option Default Description
server, s http://127.0.0.1:4001 Location of the etcd server
namespace, n /environments/production Etcd directory where the environment variables are fetched. You can watch multiple namespaces by using a comma-separated list (/environments/production,/environments/global)
shutdown-behaviour, b exit Strategy to apply when the process exit, further information into the next paragraph

Shutdown strategies

  • restart: etcd3env rerun the command when the wrapped process exits
  • exit: The etcd3env process exits with the same exit status as the wrapped process. This is likely the best choice for Kubernetes services, as they will be automatically restarted.

Command line

The CLI interface supports all of the options detailed above.

Example

Assuming an etcd v3 server is running with a /env/test/ prefix set:

etcd3env --server http://172.31.0.1:2379 --namespace /env/test/ bash
[N 180222 14:06:41 context.go:46] Connected to server: [http://172.31.0.1:2379]
$ printenv

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors