package dns import ( "fmt" "os" "github.com/libdns/cloudflare" "github.com/libdns/libdns" ) const ( // CloudflareAPIToken is the environment variable // containing the API Token CloudflareAPIToken = "CLOUDFLARE_DNS_API_TOKEN" ) // Provider manages DNS entries type Provider interface { libdns.RecordGetter libdns.RecordDeleter libdns.RecordSetter libdns.RecordAppender } // DefaultDNSProvider returns a cloudflare DNS provider // using an API Token from env [CloudflareAPIToken] func DefaultDNSProvider() (*cloudflare.Provider, error) { s := os.Getenv(CloudflareAPIToken) if s == "" { return nil, fmt.Errorf("%q: %s", CloudflareAPIToken, "not found") } p := &cloudflare.Provider{ APIToken: s, } return p, nil }