Pull http config flag merge into public method

pull/3864/head
Kyle Havlovitz 7 years ago
parent 06efeea731
commit d16f103b48
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C

@ -87,6 +87,12 @@ func (f *HTTPFlags) Token() string {
func (f *HTTPFlags) APIClient() (*api.Client, error) { func (f *HTTPFlags) APIClient() (*api.Client, error) {
c := api.DefaultConfig() c := api.DefaultConfig()
f.MergeOntoConfig(c)
return api.NewClient(c)
}
func (f *HTTPFlags) MergeOntoConfig(c *api.Config) {
f.address.Merge(&c.Address) f.address.Merge(&c.Address)
f.token.Merge(&c.Token) f.token.Merge(&c.Token)
f.caFile.Merge(&c.TLSConfig.CAFile) f.caFile.Merge(&c.TLSConfig.CAFile)
@ -95,6 +101,4 @@ func (f *HTTPFlags) APIClient() (*api.Client, error) {
f.keyFile.Merge(&c.TLSConfig.KeyFile) f.keyFile.Merge(&c.TLSConfig.KeyFile)
f.tlsServerName.Merge(&c.TLSConfig.Address) f.tlsServerName.Merge(&c.TLSConfig.Address)
f.datacenter.Merge(&c.Datacenter) f.datacenter.Merge(&c.Datacenter)
return api.NewClient(c)
} }

Loading…
Cancel
Save