iron-app

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2014 License: MPL-2.0 Imports: 11 Imported by: 0

README

envconsul

envconsul sets environmental variables for processes by reading them from Consul's K/V store.

envconsul allows applications to be configured with environmental variables, without having to be knowledgable about the existence of Consul. This makes it especially easy to configure applications throughout all your environments: development, testing, production, etc.

envconsul is inspired by envdir in its simplicity, name, and function.

Download & Usage

Download a release from the releases page. Run envconsul to see the usage help:


$ envconsul
Usage: envconsul.exe [options] prefix child...

  Sets environmental variables for the child process by reading
  K/V from Consul's K/V store with the given prefix.

Options:

  -addr="127.0.0.1:8500": consul HTTP API address with port
  -dc="": consul datacenter, uses local if blank
  -errexit=false: exit if there is an error watching config keys
  -reload=false: if set, restarts the process when config changes
  -sanitize=false: turn invalid characters in the key into underscores
  -upcase=false: make all environmental variable keys uppercase

Example

We run the example below against our NYC demo server. This lets you set keys/values in a public place to just quickly test envconsul. Note that the demo server will clear the k/v store every 30 minutes.

After setting the prefix/FOO key to "bar" on the demo server, we can see it work:

$ envconsul -addr="nyc1.demo.consul.io:80" prefix env
FOO=bar

We can also ask envconsul to watch for any configuration changes and restart our process:

$ envconsul -addr="nyc1.demo.consul.io:80" -reload \
  prefix /bin/sh -c "env; echo "-----"; sleep 1000"
FOO=bar
-----
FOO=baz
-----
FOO=baz
BAR=foo
-----

The above output happened by setting keys and values within the online demo UI while envconsul was running.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL