review suggestions

This commit is contained in:
Mikhail Rozentsvayg 2025-02-18 14:54:13 -08:00
parent f659f40697
commit 799ec6d2c9
2 changed files with 10 additions and 5 deletions

View File

@ -707,6 +707,9 @@ func groupByNameAndTypeWithCh(records []cloudflare.DNSRecord, chs []cloudflare.C
// create single endpoint with all the targets for each name/type
for _, records := range groups {
if len(records) == 0 {
return endpoints
}
targets := make([]string, len(records))
for i, record := range records {
targets[i] = record.Content
@ -716,7 +719,11 @@ func groupByNameAndTypeWithCh(records []cloudflare.DNSRecord, chs []cloudflare.C
records[0].Type,
endpoint.TTL(records[0].TTL),
targets...)
ep.WithProviderSpecific(source.CloudflareProxiedKey, strconv.FormatBool(*records[0].Proxied))
proxied := false
if records[0].Proxied != nil {
proxied = *records[0].Proxied
}
ep.WithProviderSpecific(source.CloudflareProxiedKey, strconv.FormatBool(proxied))
if _, ok := customOriginServers[records[0].Name]; ok {
ep.WithProviderSpecific(source.CloudflareCustomHostnameKey, customOriginServers[records[0].Name])
}

View File

@ -190,15 +190,13 @@ func getAliasFromAnnotations(annotations map[string]string) bool {
func getProviderSpecificAnnotations(annotations map[string]string) (endpoint.ProviderSpecific, string) {
providerSpecificAnnotations := endpoint.ProviderSpecific{}
v, exists := annotations[CloudflareProxiedKey]
if exists {
if v, exists := annotations[CloudflareProxiedKey]; exists {
providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
Name: CloudflareProxiedKey,
Value: v,
})
}
v, exists = annotations[CloudflareCustomHostnameKey]
if exists {
if v, exists := annotations[CloudflareCustomHostnameKey]; exists {
providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
Name: CloudflareCustomHostnameKey,
Value: v,