Split BaseCommand http config into a separate function

This commit is contained in:
Kyle Havlovitz 2017-09-29 11:06:19 -07:00
parent 0c00d980aa
commit 624be65d35
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
1 changed files with 5 additions and 1 deletions

View File

@ -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 {