From 624be65d35d01260c240192abc4a4d71c906af48 Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Fri, 29 Sep 2017 11:06:19 -0700 Subject: [PATCH] Split BaseCommand http config into a separate function --- command/base.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/command/base.go b/command/base.go index 96b3bec99..5ed9ac072 100644 --- a/command/base.go +++ b/command/base.go @@ -62,6 +62,11 @@ func (c *BaseCommand) HTTPClient() (*api.Client, error) { } config := api.DefaultConfig() + c.MergeHTTPConfig(config) + return api.NewClient(config) +} + +func (c *BaseCommand) MergeHTTPConfig(config *api.Config) { c.httpAddr.Merge(&config.Address) c.token.Merge(&config.Token) c.caFile.Merge(&config.TLSConfig.CAFile) @@ -70,7 +75,6 @@ func (c *BaseCommand) HTTPClient() (*api.Client, error) { c.keyFile.Merge(&config.TLSConfig.KeyFile) c.tlsServerName.Merge(&config.TLSConfig.Address) c.datacenter.Merge(&config.Datacenter) - return api.NewClient(config) } func (c *BaseCommand) HTTPAddr() string {