mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-12-18 14:49:21 +08:00
Merge branch 'main' into provider/infomaniak
This commit is contained in:
commit
c85eca4d6a
3 changed files with 31 additions and 6 deletions
|
|
@ -81,6 +81,7 @@ Currently supported Domain Registrars:
|
||||||
- Name.com
|
- Name.com
|
||||||
- OpenSRS
|
- OpenSRS
|
||||||
- OVH
|
- OVH
|
||||||
|
- Porkbun
|
||||||
- Realtime Register
|
- Realtime Register
|
||||||
|
|
||||||
At Stack Overflow, we use this system to manage hundreds of domains
|
At Stack Overflow, we use this system to manage hundreds of domains
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,27 @@ This provider does not recognize any special metadata fields unique to Porkbun.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
An example configuration:
|
An example configuration: (DNS hosted with Porkbun):
|
||||||
|
|
||||||
{% code title="dnsconfig.js" %}
|
{% code title="dnsconfig.js" %}
|
||||||
```javascript
|
```javascript
|
||||||
var REG_NONE = NewRegistrar("none");
|
var REG_PORKBUN = NewRegistrar("porkbun");
|
||||||
var DSP_PORKBUN = NewDnsProvider("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"),
|
A("test", "1.2.3.4"),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -254,14 +254,25 @@ func (client *gandiv5Provider) GetZoneRecordsCorrections(dc *models.DomainConfig
|
||||||
case diff2.CHANGE:
|
case diff2.CHANGE:
|
||||||
msgs := strings.Join(inst.Msgs, "\n")
|
msgs := strings.Join(inst.Msgs, "\n")
|
||||||
domain := dc.Name
|
domain := dc.Name
|
||||||
label := inst.Key.NameFQDN
|
// DNSControl attempts to lowercase all labels (See Opinion #4 in
|
||||||
shortname := dnsutil.TrimDomainName(label, dc.Name)
|
// 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)
|
ns := recordsToNative(inst.New, dc.Name)
|
||||||
corrections = append(corrections,
|
corrections = append(corrections,
|
||||||
&models.Correction{
|
&models.Correction{
|
||||||
Msg: msgs,
|
Msg: msgs,
|
||||||
F: func() error {
|
F: func() error {
|
||||||
res, err := g.UpdateDomainRecordsByName(domain, shortname, ns)
|
res, err := g.UpdateDomainRecordsByName(domain, originalRrsetName, ns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%+v ret=%03d: %w", res, res.Code, err)
|
return fmt.Errorf("%+v ret=%03d: %w", res, res.Code, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue