Skip to content

Commit

Permalink
Merge pull request #26 from AnchorFree/event_selector_tasks
Browse files Browse the repository at this point in the history
Added YAML support to event selector configuration
  • Loading branch information
Mykolaichenko authored Sep 13, 2019
2 parents 67cf094 + 82d2dd9 commit 7bdcdb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/event_selector/event_selector.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package event_selector

import (
"encoding/json"
"gopkg.in/yaml.v2"
"sync"

"github.com/anchorfree/data-go/pkg/consul"
Expand Down Expand Up @@ -40,7 +40,7 @@ func (es *EventSelector) RunConfigWatcher() error {

func (es *EventSelector) updateConfig(rawConfig []byte) error {
selectors := &Selectors{}
err := json.Unmarshal(rawConfig, selectors)
err := yaml.Unmarshal(rawConfig, selectors)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/event_selector/selectors_config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package event_selector

type Selectors struct {
Selectors []Selector `json:"selectors"`
Selectors []Selector `yaml:"selectors"`
}

type Selector struct {
TargetTopic string `json:"target_topic"`
Matching map[string]string `json:"matching"`
TargetTopic string `yaml:"target_topic"`
Matching map[string]string `yaml:"matching"`
}

0 comments on commit 7bdcdb5

Please sign in to comment.