From d16f103b480bc3ce3af8d602402a64c0fd6225e5 Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Mon, 5 Feb 2018 15:00:04 -0800 Subject: [PATCH] Pull http config flag merge into public method --- command/flags/http.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/command/flags/http.go b/command/flags/http.go index 1fa78e1671..591567a4f0 100644 --- a/command/flags/http.go +++ b/command/flags/http.go @@ -87,6 +87,12 @@ func (f *HTTPFlags) Token() string { func (f *HTTPFlags) APIClient() (*api.Client, error) { c := api.DefaultConfig() + f.MergeOntoConfig(c) + + return api.NewClient(c) +} + +func (f *HTTPFlags) MergeOntoConfig(c *api.Config) { f.address.Merge(&c.Address) f.token.Merge(&c.Token) f.caFile.Merge(&c.TLSConfig.CAFile) @@ -95,6 +101,4 @@ func (f *HTTPFlags) APIClient() (*api.Client, error) { f.keyFile.Merge(&c.TLSConfig.KeyFile) f.tlsServerName.Merge(&c.TLSConfig.Address) f.datacenter.Merge(&c.Datacenter) - - return api.NewClient(c) }