Refactor config file support

Change-Id: I903618eee80951d858a3001ed825c6e70a5c6316
Reviewed-on: http://review.couchbase.org/34008
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>