Merge branch 'main' into provider/infomaniak

This commit is contained in:
Jonathan Beliën 2025-05-24 12:57:44 +02:00 committed by GitHub
commit c85eca4d6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 6 deletions

View file

@ -81,6 +81,7 @@ Currently supported Domain Registrars:
- Name.com
- OpenSRS
- OVH
- Porkbun
- Realtime Register
At Stack Overflow, we use this system to manage hundreds of domains

View file

@ -23,14 +23,27 @@ This provider does not recognize any special metadata fields unique to Porkbun.
## Usage
An example configuration:
An example configuration: (DNS hosted with Porkbun):
{% code title="dnsconfig.js" %}
```javascript
var REG_NONE = NewRegistrar("none");
var REG_PORKBUN = NewRegistrar("porkbun");
var DSP_PORKBUN = NewDnsProvider("porkbun");
D("example.com", REG_NONE, DnsProvider(DSP_PORKBUN),
D("example.com", REG_PORKBUN, DnsProvider(DSP_PORKBUN),
A("test", "1.2.3.4"),
);
```
{% endcode %}
An example configuration: (Registrar only. DNS hosted elsewhere)
{% code title="dnsconfig.js" %}
```javascript
var REG_PORKBUN = NewRegistrar("porkbun");
var DSP_R53 = NewDnsProvider("r53");
D("example.com", REG_PORKBUN, DnsProvider(DSP_R53),
A("test", "1.2.3.4"),
);
```

View file

@ -254,14 +254,25 @@ func (client *gandiv5Provider) GetZoneRecordsCorrections(dc *models.DomainConfig
case diff2.CHANGE:
msgs := strings.Join(inst.Msgs, "\n")
domain := dc.Name
label := inst.Key.NameFQDN
shortname := dnsutil.TrimDomainName(label, dc.Name)
// DNSControl attempts to lowercase all labels (See Opinion #4 in
// https://docs.dnscontrol.org/developer-info/opinions).
// Sadly, the Gandi API has a bug (I consider it a bug) that to update the
// records at a particular label, the request must specify the label with the
// same case as what is stored at Gandi. In other words, the update API does
// not use a case-insensitive comparison when looking up the label being
// updated.
// Luckily we save the record as it came from the API in
// `.Original`. We can use that to gurantee we specify the label
// with the case that Gandi is expecting.
originalRrsetName := inst.Old[0].Original.(livedns.DomainRecord).RrsetName
ns := recordsToNative(inst.New, dc.Name)
corrections = append(corrections,
&models.Correction{
Msg: msgs,
F: func() error {
res, err := g.UpdateDomainRecordsByName(domain, shortname, ns)
res, err := g.UpdateDomainRecordsByName(domain, originalRrsetName, ns)
if err != nil {
return fmt.Errorf("%+v ret=%03d: %w", res, res.Code, err)
}