Skip to content

Commit

Permalink
Orchestrator webhook JSON to require "address" field
Browse files Browse the repository at this point in the history
  • Loading branch information
pwilczynskiclearcode committed Jan 16, 2025
1 parent 1a4c7c7 commit 9503cd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions discovery/wh_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

type webhookResponse struct {
Address string `json:"address,omitempty"`
Address string `json:"address"`
Score float32 `json:"score,omitempty"`
}

Expand Down Expand Up @@ -147,12 +147,9 @@ func deserializeWebhookJSON(body []byte) ([]common.OrchestratorLocalInfo, error)
}
var infos []common.OrchestratorLocalInfo
for _, addr := range addrs {
if addr.Address == "" {
continue
}
uri, err := url.ParseRequestURI(addr.Address)
if err != nil {
glog.Errorf("Unable to parse address %q : %s", addr.Address, err)
glog.Errorf("Unable to parse address %q : %s", addr.Address, err)
continue
}
infos = append(infos, common.OrchestratorLocalInfo{URL: uri, Score: addr.Score})
Expand Down
6 changes: 3 additions & 3 deletions doc/orchwebhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ For example:

```json
[
{"address":"https://10.4.3.2:8935"},
{"address":"https://10.4.4.3:8935"},
{"address":"https://10.4.5.2:8935"}
{"address":"https://10.4.3.2:8935", "score": 1.0},
{"address":"https://10.4.4.3:8935", "score": 1.0},
{"address":"https://10.4.5.2:8935", "score": 1.0}
]
```

Expand Down

0 comments on commit 9503cd2

Please sign in to comment.