func NewNodeServicesConfigWatcher(client *api.Client,
	logger *log.Logger) (*NodeServicesConfigWatcher, error) {
	w := &NodeServicesConfigWatcher{
		client: client,
		logger: logger,
		ch:     make(chan *Config),
	}

	config, err := client.Agent().Self()
	if err != nil {
		return nil, err
	}
	nodeName := config["Config"]["NodeName"].(string)

	// Setup watch plan for config
	plan, err := watch.Parse(map[string]interface{}{
		"type": "node_services",
		"node": nodeName,
	})
	if err != nil {
		return nil, err
	}
	w.plan = plan
	w.plan.HybridHandler = w.handler
	go w.plan.RunWithClientAndLogger(w.client, w.logger)
	return w, nil
}
// NewNodeServicesConfigWatcher creates an AgentConfigWatcher.
NewNodeServicesConfigWatcher creates an AgentConfigWatcher.
// NewNodeServicesConfigWatcher creates an AgentConfigWatcher .
func NewNodeServicesConfigWatcher(client *api.Client,
	logger *log.Logger) (*NodeServicesConfigWatcher, error) {
	w := &NodeServicesConfigWatcher{
		client: client,
		logger: logger,
		ch:     make(chan *Config),
	}
	config, err := client.Agent().Self()
	if err != nil {
		return nil, err
	}
	nodeName := config["Config"]["NodeName"].(string)
	plan, err := watch.Parse(map[string]interface{}{
		"type": "node_services",
		"node": nodeName,
	})
	if err != nil {
		return nil, err
	}
	w.plan = plan
	w.plan.HybridHandler = w.handler
	go w.plan.RunWithClientAndLogger(w.client, w.logger)
	return w, nil
}
func NewNodeServicesConfigWatcher ( client * api . Client , logger * log . Logger ) ( * NodeServicesConfigWatcher , error ) { w := & NodeServicesConfigWatcher { client : client , logger : logger , ch : make ( chan * Config ) , } config , err := client . Agent ( ) . Self ( ) if err != nil { return nil , err } nodeName := config [ " " ] [ " " ] . ( string ) plan , err := watch . Parse ( map [ string ] interface { } { " " : " " , " " : nodeName , } ) if err != nil { return nil , err } w . plan = plan w . plan . HybridHandler = w . handler go w . plan . RunWithClientAndLogger ( w . client , w . logger ) return w , nil }
NewNodeServicesConfigWatcher creates an AgentConfigWatcher.
NewNodeServicesConfigWatcher creates an AgentConfigWatcher .
// Setup watch plan for config