coreos/etcd — pull request #266 by benbjohnson (2013-10-22 03:45:14+00:00)
Title: Tiered Configuration

## Overview

This pull request takes @kelseyhightower's pull request #226 and merges it into the `0.2` branch. I moved the code into the `server` package since all the options had to do with the servers. I also cleaned out a lot of the remaining code in the `main` branch.

## Notes

I had to do some refactoring on the code to accomplish a couple things:

1. Allow the code to be testable. There's full coverage on the configuration in `config_test.go`.

2. Allow proper tiering of configuration. It starts with the system config which can be overridden by a custom config (`-config`), then overridden by environment variables, and finally overridden by command line arguments.

3. Go's implementation of command line arguments is a pain so I had to do some tweaks to separate out configuration parameters and non-config parameters (e.g. `-version`).

4. Clean up the environment variables so that they're read via Go `StructField` tags similar to `encoding/json`.

Let me know what you guys think.

/cc: @philips @xiangli-cmu