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

Add PowerDNS support #15

merged 2 commits into from Dec 29, 2017
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -0,0 +1,35 @@
// Package pdns adapts the lego PowerDNS
// provider for Caddy. Importing this package plugs it in.
package pdns

import (


This comment has been minimized.

Copy link

mholt Dec 28, 2017


While we're on the subject of spelling it out, do you think the package should be "powerdns" too? (I mean, in case there's some other DNS provider that starts with a P)

This comment has been minimized.

Copy link

FrankPetrilli Dec 28, 2017

Author Contributor

I used the name as given in lego. Further, it's common for PowerDNS to be referred to as pdns, as for example, the binary for the server is pdns_server.


func init() {
caddytls.RegisterDNSProvider("powerdns", NewDNSProvider)

// NewDNSProvider returns a new PowerDNS challenge provider.
// The credentials are interpreted as follows:
// len(0): use credentials from environment
// len(2): credentials[0] = pdns API URL, credentials[1] = pdns API key
func NewDNSProvider(credentials ...string) (caddytls.ChallengeProvider, error) {
switch len(credentials) {
case 0:
return pdns.NewDNSProvider()
case 2:
url, err := url.Parse(credentials[0])
if err != nil {
return nil, errors.New("Invalid URL format")
return pdns.NewDNSProviderCredentials(url, credentials[1])
return nil, errors.New("invalid credentials length")
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.