mirror of https://github.com/status-im/consul.git
Split BaseCommand http config into a separate function
This commit is contained in:
parent
f8da72a8b5
commit
787787f904
|
@ -62,6 +62,11 @@ func (c *BaseCommand) HTTPClient() (*api.Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
config := api.DefaultConfig()
|
config := api.DefaultConfig()
|
||||||
|
c.MergeHTTPConfig(config)
|
||||||
|
return api.NewClient(config)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *BaseCommand) MergeHTTPConfig(config *api.Config) {
|
||||||
c.httpAddr.Merge(&config.Address)
|
c.httpAddr.Merge(&config.Address)
|
||||||
c.token.Merge(&config.Token)
|
c.token.Merge(&config.Token)
|
||||||
c.caFile.Merge(&config.TLSConfig.CAFile)
|
c.caFile.Merge(&config.TLSConfig.CAFile)
|
||||||
|
@ -70,7 +75,6 @@ func (c *BaseCommand) HTTPClient() (*api.Client, error) {
|
||||||
c.keyFile.Merge(&config.TLSConfig.KeyFile)
|
c.keyFile.Merge(&config.TLSConfig.KeyFile)
|
||||||
c.tlsServerName.Merge(&config.TLSConfig.Address)
|
c.tlsServerName.Merge(&config.TLSConfig.Address)
|
||||||
c.datacenter.Merge(&config.Datacenter)
|
c.datacenter.Merge(&config.Datacenter)
|
||||||
return api.NewClient(config)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *BaseCommand) HTTPAddr() string {
|
func (c *BaseCommand) HTTPAddr() string {
|
||||||
|
|
Loading…
Reference in New Issue