Always create a consul.Syncer. Use a default Consul Config if necessary.
This commit is contained in:
parent
e69232dd73
commit
f6a0459ae5
|
@ -205,7 +205,14 @@ type UniversalExecutor struct {
|
|||
|
||||
// NewExecutor returns an Executor
|
||||
func NewExecutor(logger *log.Logger) Executor {
|
||||
shutdownCh := make(chan struct{})
|
||||
cs, err := consul.NewSyncer(nil, shutdownCh, logger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
exec := &UniversalExecutor{
|
||||
consulSyncer: cs,
|
||||
logger: logger,
|
||||
processExited: make(chan interface{}),
|
||||
shutdownCh: make(chan struct{}),
|
||||
|
|
|
@ -111,7 +111,14 @@ type Syncer struct {
|
|||
func NewSyncer(config *config.ConsulConfig, shutdownCh chan struct{}, logger *log.Logger) (*Syncer, error) {
|
||||
var err error
|
||||
var c *consul.Client
|
||||
|
||||
cfg := consul.DefaultConfig()
|
||||
|
||||
// If a nil config was provided, fall back to the default config
|
||||
if config == nil {
|
||||
config = cfg
|
||||
}
|
||||
|
||||
if config.Addr != "" {
|
||||
cfg.Address = config.Addr
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue