Skip to content

Commit

Permalink
Remove backward compatibility (Fixes #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanevet committed May 18, 2018
1 parent a218a76 commit 854ce22
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ type Config struct {
}

type Node struct {
Certname string `json:"certname"`
Exporters map[string]interface{} `json:"value"`
Certname string `json:"certname"`
Exporters map[string][]string `json:"value"`
}

type StaticConfig struct {
Expand Down Expand Up @@ -134,23 +134,8 @@ func getTargets() (c []byte, err error) {

for _, node := range nodes {
for jobName, targets := range node.Exporters {
var t []string

switch v := targets.(type) {
case string:
log.Warningf("Deprecated: target should be an Array not a String: %v", v)
t = []string{v}
case []interface{}:
t = make([]string, len(v))
for i := range v {
t[i] = v[i].(string)
}
default:
log.Errorf("failed to determine kind of targets: %v", err)
}

for i := range t {
url, err := url.Parse(t[i])
for i := range targets {
url, err := url.Parse(targets[i])
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 854ce22

Please sign in to comment.