Skip to content

Commit

Permalink
Added YAML support to event selector configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykolaichenko committed Sep 13, 2019
1 parent 67cf094 commit 82d2dd9
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 82d2dd9

Please sign in to comment.