Skip to content

Commit

Permalink
[IMP] Hetzner: JSON struct
Browse files Browse the repository at this point in the history
  • Loading branch information
lieblinger committed Oct 10, 2023
1 parent f3ccf8d commit 4c7bb5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/provider/providers/hetzner/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ func (p *Provider) updateRecord(ctx context.Context, client *http.Client,
decoder := json.NewDecoder(response.Body)
var parsedJSON struct {
Record struct {
Value string `json:"value"`
Value netip.Addr `json:"value"`
} `json:"record"`
}
err = decoder.Decode(&parsedJSON)
if err != nil {
return netip.Addr{}, fmt.Errorf("json decoding response body: %w", err)
}

newIP, err = netip.ParseAddr(parsedJSON.Record.Value)
newIP = parsedJSON.Record.Value
if err != nil {
return netip.Addr{}, fmt.Errorf("%w: %w", errors.ErrIPReceivedMalformed, err)
} else if newIP.Compare(ip) != 0 {
Expand Down

0 comments on commit 4c7bb5d

Please sign in to comment.