Skip to content

Commit

Permalink
Tools: Fix Cloudflare SRV update utility after API change (#6020)
Browse files Browse the repository at this point in the history
  • Loading branch information
onetechnical authored Jun 7, 2024
1 parent 052dff4 commit 9853ab2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 2 additions & 6 deletions tools/network/cloudflare/createRecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ type createDNSRecord struct {
// https://community.cloudflare.com/t/cloudflare-api-v4-srv-dns-creation-failure-in-php/25677/7
type createSRVRecord struct {
Type string `json:"type"`
Name string `json:"name"`
Data struct {
Name string `json:"name"`
TTL uint `json:"ttl"`
Service string `json:"service"`
Proto string `json:"proto"`
Weight uint `json:"weight"`
Port uint `json:"port"`
Priority uint `json:"priority"`
Expand Down Expand Up @@ -90,10 +88,8 @@ func createSRVRecordRequest(zoneID string, authToken string, name string, servic
requestJSON := createSRVRecord{
Type: "SRV",
}
requestJSON.Data.Name = name
requestJSON.Name = service + "." + protocol + "." + name
requestJSON.Data.TTL = ttl
requestJSON.Data.Service = service
requestJSON.Data.Proto = protocol
requestJSON.Data.Weight = weight
requestJSON.Data.Port = port
requestJSON.Data.Priority = priority
Expand Down
4 changes: 1 addition & 3 deletions tools/network/cloudflare/updateRecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ func updateSRVRecordRequest(zoneID string, authToken string, recordID string, na

requestJSON := createSRVRecord{
Type: "SRV",
Name: fmt.Sprintf("%s.%s.%s", service, protocol, name),
}
requestJSON.Data.Name = name
requestJSON.Data.TTL = ttl
requestJSON.Data.Service = service
requestJSON.Data.Proto = protocol
requestJSON.Data.Weight = weight
requestJSON.Data.Port = port
requestJSON.Data.Priority = priority
Expand Down

0 comments on commit 9853ab2

Please sign in to comment.