etcd + env = awesome!
env command integrated with etcd server
$ curl http://127.0.0.1:4001/v1/keys/app/db -d value="newdb"
$ curl http://127.0.0.1:4001/v1/keys/app/cache -d value="new cache"
$ curl http://127.0.0.1:4001/v1/keys/app2/db -d value="otherdb"
$ curl http://localhost:4001/v1/keys/app
[{"action":"GET","key":"/app/db","value":"newdb","index":4},{"action":"GET","key":"/app/cache","value":"new cache","index":4}]
$ etcdenv -key=/app/
DB=newdb
CACHE=new cache
$ etcdenv -key=/app/ ruby web.rb
$ etcdenv -key=/ -r
DB=newdb,otherdb
CACHE=new cache
$ cat myapp.sh
#!/path/to/etcdenv -key=/myapp ./myapp.sh
If you are using OSs which the shell doesn't parse arguments separated with spaces, try to use -s
option.
$ cat myapp.sh
#!/path/to/etcdenv -s -key=/myapp ./myapp.sh
$ cat Procfile
web: etcdenv -key=/myapp/ ruby web.rb