Store your application config in Redis, expose it as environment variables to your app
Go
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
.gitignore Initial commit Jun 25, 2012
MIT-LICENSE Add MIT license Jun 25, 2012
README.md Add Why? and Install to README Jun 25, 2012
redis-env.go Fix bug in redis key generation Jul 1, 2012

README.md

redis-env

redis-env allows you to easily use environment variables for configuring your application. The app config is stored in a centralized Redis database.

Why?

  • Storing application config in environment variables is better than storing it in configuration files. See the Twelve-Factor app for more.
  • Redis makes it easy to store and update the config centrally without sharing disks or pushing files out to all your servers.
  • We're not all running on Heroku. :)

Install

git clone git://github.com/brynary/redis-env.git
go build
mv redis-env /usr/local/bin

Usage

Add config variables

redis-env --add DATABASE_URL=mysql://user@db-host.local

Remove config variables

redis-env --remove DATABASE_URL

List config variables

redis-env --list

Prints each config variable, one per line.

Run

redis-env --run rackup

Loads the config as environment variables then execs the provided command. Exist with code 111 if the config could not be loaded from Redis, otherwise exits with the code from the executed command.

Options

  • --netaddr NETADDR -- The location of the Redis instance. Defaults to tcp:120.0.0.1:6379
  • --db DB_INDEX -- The Redis database index for the config data. Defaults to 0.
  • --name NAME -- The name of the config to read. Defaults to default. Useful for storing multiple app configs in the same Redis.

Note: This is the first Go code I've ever written. Please be gentle.