Client should validate the incoming host value

Convert host:port and URLs passed to client.New() into the proper
values, and return an error if the value is invalid.  Change CLI
to return an error if -master is invalid.  Remove Client.rawRequest
which was not in use, and fix the involved tests. Add NewOrDie

Preserves the behavior of the client to not auth when a non-https
URL is passed (although in the future this should be corrected).
This commit is contained in:
Clayton Coleman
2014-08-28 09:56:38 -04:00
parent fa17697194
commit 818f357128
15 changed files with 203 additions and 172 deletions

View File

@@ -53,7 +53,10 @@ func main() {
if *master != "" {
glog.Infof("Using api calls to get config %v", *master)
//TODO: add auth info
client := client.New(*master, nil)
client, err := client.New(*master, nil)
if err != nil {
glog.Fatalf("Invalid -master: %v", err)
}
config.NewSourceAPI(
client,
30*time.Second,