mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
refactor(dns): remove leading dot from domain when interecting with Uncloud DNS
This commit is contained in:
+1
-10
@@ -8,7 +8,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// The dns package code is based on https://github.com/acorn-io/runtime/blob/main/pkg/dns.
|
// The dns package code is based on https://github.com/acorn-io/runtime/blob/main/pkg/dns.
|
||||||
@@ -53,18 +52,10 @@ func (c *client) ReserveDomain(endpoint string) (string, string, error) {
|
|||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
domain := resp.Name
|
return resp.Name, resp.Token, nil
|
||||||
if strings.HasPrefix(domain, ".") {
|
|
||||||
domain = domain[1:]
|
|
||||||
}
|
|
||||||
return domain, resp.Token, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) CreateRecords(endpoint, domain, token string, records []RecordRequest) ([]RecordResponse, error) {
|
func (c *client) CreateRecords(endpoint, domain, token string, records []RecordRequest) ([]RecordResponse, error) {
|
||||||
// TODO: update Uncloud DNS service to not use a leading dot for domain names.
|
|
||||||
if !strings.HasPrefix(domain, ".") {
|
|
||||||
domain = "." + domain
|
|
||||||
}
|
|
||||||
url := fmt.Sprintf("%s/domains/%s/records", endpoint, domain)
|
url := fmt.Sprintf("%s/domains/%s/records", endpoint, domain)
|
||||||
|
|
||||||
var resp []RecordResponse
|
var resp []RecordResponse
|
||||||
|
|||||||
Reference in New Issue
Block a user