1//go:build libdns_gandi || !libdns_separate2// +build libdns_gandi !libdns_separate34package libdns56import (7 "fmt"89 "github.com/foxcpp/maddy/framework/config"10 "github.com/foxcpp/maddy/framework/log"11 "github.com/foxcpp/maddy/framework/module"12 "github.com/libdns/gandi"13)1415func init() {16 module.Register("libdns.gandi", func(modName, instName string, _, _ []string) (module.Module, error) {17 p := gandi.Provider{}18 return &ProviderModule{19 RecordDeleter: &p,20 RecordAppender: &p,21 setConfig: func(c *config.Map) {22 c.String("api_token", false, false, "", &p.APIToken)23 c.String("personal_token", false, false, "", &p.BearerToken)24 },25 afterConfig: func() error {26 if p.APIToken != "" {27 log.Println("libdns.gandi: api_token is deprecated, use personal_token instead (https://api.gandi.net/docs/authentication/)")28 }29 if p.APIToken == "" && p.BearerToken == "" {30 return fmt.Errorf("libdns.gandi: either api_token or personal_token should be specified")31 }32 return nil33 },34 instName: instName,35 modName: modName,36 }, nil37 })38}