Rename consul.ConsulConfig to consul.AgentConfig
There were two `ConsulConfig` structs running around, one of them needed to go away. Rely on the package's path to provide context for the type of AgentConfig.
This commit is contained in:
parent
4e2835d5ff
commit
e97652bbfb
|
@ -72,7 +72,7 @@ func testServer(t *testing.T, cb func(*nomad.Config)) (*nomad.Server, string) {
|
|||
func testClient(t *testing.T, cb func(c *config.Config)) *Client {
|
||||
conf := DefaultConfig()
|
||||
conf.DevMode = true
|
||||
conf.ConsulConfig = &consul.ConsulConfig{}
|
||||
conf.ConsulConfig = &consul.AgentConfig{}
|
||||
if cb != nil {
|
||||
cb(conf)
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ type Config struct {
|
|||
Revision string
|
||||
|
||||
// ConsulConfig is the configuration to connect with Consul Agent
|
||||
ConsulConfig *consul.ConsulConfig
|
||||
ConsulConfig *consul.AgentConfig
|
||||
|
||||
// StatsDataPoints is the number of resource usage data points the Nomad
|
||||
// client keeps in memory
|
||||
|
|
|
@ -38,8 +38,8 @@ type ConsulService struct {
|
|||
shutdownLock sync.Mutex
|
||||
}
|
||||
|
||||
// ConsulConfig is the configuration used to create a new ConsulService client
|
||||
type ConsulConfig struct {
|
||||
// AgentConfig is the configuration used to create a new ConsulService client
|
||||
type AgentConfig struct {
|
||||
Addr string
|
||||
Token string
|
||||
Auth string
|
||||
|
@ -60,7 +60,7 @@ const (
|
|||
)
|
||||
|
||||
// NewConsulService returns a new ConsulService
|
||||
func NewConsulService(config *ConsulConfig, logger *log.Logger) (*ConsulService, error) {
|
||||
func NewConsulService(config *AgentConfig, logger *log.Logger) (*ConsulService, error) {
|
||||
var err error
|
||||
var c *consul.Client
|
||||
cfg := consul.DefaultConfig()
|
||||
|
|
|
@ -41,7 +41,7 @@ var (
|
|||
)
|
||||
|
||||
func TestConsulServiceRegisterServices(t *testing.T) {
|
||||
cs, err := NewConsulService(&ConsulConfig{}, logger)
|
||||
cs, err := NewConsulService(&AgentConfig{}, logger)
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func TestConsulServiceRegisterServices(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestConsulServiceUpdateService(t *testing.T) {
|
||||
cs, err := NewConsulService(&ConsulConfig{}, logger)
|
||||
cs, err := NewConsulService(&AgentConfig{}, logger)
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ type Executor interface {
|
|||
// ConsulContext holds context to configure the consul client and run checks
|
||||
type ConsulContext struct {
|
||||
// ConsulConfig is the configuration used to create a consul client
|
||||
ConsulConfig *consul.ConsulConfig
|
||||
ConsulConfig *consul.AgentConfig
|
||||
|
||||
// ContainerID is the ID of the container
|
||||
ContainerID string
|
||||
|
|
|
@ -73,7 +73,7 @@ func createLogCollector(config *plugin.ClientConfig, w io.Writer,
|
|||
}
|
||||
|
||||
func consulContext(clientConfig *config.Config, containerID string) *executor.ConsulContext {
|
||||
cfg := consul.ConsulConfig{
|
||||
cfg := consul.AgentConfig{
|
||||
Addr: clientConfig.ReadDefault("consul.address", "127.0.0.1:8500"),
|
||||
Token: clientConfig.Read("consul.token"),
|
||||
Auth: clientConfig.Read("consul.auth"),
|
||||
|
|
|
@ -30,7 +30,7 @@ type Agent struct {
|
|||
logOutput io.Writer
|
||||
|
||||
consulService *consul.ConsulService // consulService registers the Nomad agent with the consul agent
|
||||
consulConfig *consul.ConsulConfig // consulConfig is the consul configuration the Nomad client uses to connect with Consul agent
|
||||
consulConfig *consul.AgentConfig // consulConfig is the configuration the Nomad client uses to connect with Consul agent
|
||||
serverHTTPAddr string
|
||||
clientHTTPAddr string
|
||||
|
||||
|
@ -488,7 +488,7 @@ func (a *Agent) Stats() map[string]map[string]string {
|
|||
}
|
||||
|
||||
func (a *Agent) createConsulConfig() {
|
||||
cfg := &consul.ConsulConfig{
|
||||
cfg := &consul.AgentConfig{
|
||||
Addr: a.config.ConsulConfig.Addr,
|
||||
Token: a.config.ConsulConfig.Token,
|
||||
Auth: a.config.ConsulConfig.Auth,
|
||||
|
|
Loading…
Reference in New Issue