Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade Gandi libdns to 1.0.3 #673

Merged
merged 2 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/libdns/alidns v1.0.3-0.20230628155627-8d5d630d5516
github.com/libdns/cloudflare v0.1.1-0.20221006221909-9d3ab3c3cddd
github.com/libdns/digitalocean v0.0.0-20230728223659-4f9064657aea
github.com/libdns/gandi v1.0.3-0.20220921161957-dcd0274d2c79
github.com/libdns/gandi v1.0.3
github.com/libdns/googleclouddns v1.1.0
github.com/libdns/hetzner v0.0.1
github.com/libdns/leaseweb v0.3.1
Expand Down Expand Up @@ -168,3 +168,5 @@ require (
)

replace github.com/emersion/go-imap => github.com/foxcpp/go-imap v1.0.0-beta.1.0.20220623182312-df940c324887

replace github.com/libdns/gandi => github.com/foxcpp/libdns-gandi v1.0.4-0.20240127130558-4782f9d5ce3e // v1.0.3+maddy.1
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6
github.com/foxcpp/go-mockdns v1.0.0/go.mod h1:lgRN6+KxQBawyIghpnl5CezHFGS9VLzvtVlwxvzXTQ4=
github.com/foxcpp/go-mtasts v0.0.0-20191219193356-62bc3f1f74b8 h1:k8w0iy6GP9oeSZWUH3p2DqZHaXDKZGNs3NZGZMGfQHc=
github.com/foxcpp/go-mtasts v0.0.0-20191219193356-62bc3f1f74b8/go.mod h1:HO1YOCbBM8KjpgThMMFejHx6K/UsnEv2Oh9YGtBIlOU=
github.com/foxcpp/libdns-gandi v1.0.4-0.20240127130558-4782f9d5ce3e h1:hKk+CGUtwnKDGKINPEojeo91kx0tnV6V4tlzHehJPfg=
github.com/foxcpp/libdns-gandi v1.0.4-0.20240127130558-4782f9d5ce3e/go.mod h1:G6dw58Xnji2xX+lb+uZxGbtmfxKllm1CGHE2bOPG3WA=
github.com/frankban/quicktest v1.5.0/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
Expand Down Expand Up @@ -498,8 +500,6 @@ github.com/libdns/cloudflare v0.1.1-0.20221006221909-9d3ab3c3cddd h1:c5hc0b5/pFq
github.com/libdns/cloudflare v0.1.1-0.20221006221909-9d3ab3c3cddd/go.mod h1:ob9J/elFVmPWKNHOMynwtH0h+T3pBrEL18amCSliwAQ=
github.com/libdns/digitalocean v0.0.0-20230728223659-4f9064657aea h1:IGlMNZCUp8Ho7NYYorpP5ZJgg2mFXARs6eHs/pSqFkA=
github.com/libdns/digitalocean v0.0.0-20230728223659-4f9064657aea/go.mod h1:B2TChhOTxvBflpRTHlguXWtwa1Ha5WI6JkB6aCViM+0=
github.com/libdns/gandi v1.0.3-0.20220921161957-dcd0274d2c79 h1:s5zuoIehXkSKg6Yfd5Oh1jEfvWXSn+eAttVHufSzDPE=
github.com/libdns/gandi v1.0.3-0.20220921161957-dcd0274d2c79/go.mod h1:VN+Lh8Teq6nYszNsPSLKdIv24hOCcQu0rJWHQa2jPZc=
github.com/libdns/googleclouddns v1.1.0 h1:murPR1LfTZZObLV2OLxUVmymWH25glkMFKpDjkk2m0E=
github.com/libdns/googleclouddns v1.1.0/go.mod h1:3tzd056dfqKlf71V8Oy19En4WjJ3ybyuWx6P9bQSCIw=
github.com/libdns/hetzner v0.0.1 h1:WsmcsOKnfpKmzwhfyqhGQEIlEeEaEUvb7ezoJgBKaqU=
Expand Down
15 changes: 14 additions & 1 deletion internal/libdns/gandi.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
package libdns

import (
"fmt"

"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/log"
"github.com/foxcpp/maddy/framework/module"
"github.com/libdns/gandi"
)
Expand All @@ -16,7 +19,17 @@ func init() {
RecordDeleter: &p,
RecordAppender: &p,
setConfig: func(c *config.Map) {
c.String("api_token", false, true, "", &p.APIToken)
c.String("api_token", false, false, "", &p.APIToken)
c.String("personal_token", false, false, "", &p.BearerToken)
},
afterConfig: func() error {
if p.APIToken != "" {
log.Println("libdns.gandi: api_token is deprecated, use personal_token instead (https://api.gandi.net/docs/authentication/)")
}
if p.APIToken == "" && p.BearerToken == "" {
return fmt.Errorf("libdns.gandi: either api_token or personal_token should be specified")
}
return nil
},
instName: instName,
modName: modName,
Expand Down
8 changes: 7 additions & 1 deletion internal/libdns/provider_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
type ProviderModule struct {
libdns.RecordDeleter
libdns.RecordAppender
setConfig func(c *config.Map)
setConfig func(c *config.Map)
afterConfig func() error

instName string
modName string
Expand All @@ -17,6 +18,11 @@ type ProviderModule struct {
func (p *ProviderModule) Init(cfg *config.Map) error {
p.setConfig(cfg)
_, err := cfg.Process()
if p.afterConfig != nil {
if err := p.afterConfig(); err != nil {
return err
}
}
return err
}

Expand Down
Loading