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 support for autodns #957
Conversation
Hello, in order for a PR adding a DNS provider to be accepted, you have to:
make test
make test
make generate-dns
rm -rf .lego
./lego -m your@email.com --dns YOUR_PROVIDER_NAME -d *.example.com -d example.com -s https://acme-staging-v02.api.letsencrypt.org/directory run Note the wildcard domain is important.
make checks
|
@ldez I updated the original description of the pr with your checklist, in order to be able to edit it. |
I also go a response about the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add:
lego/providers/dns/cloudflare/cloudflare.go
Lines 101 to 105 in a5a2918
// Timeout returns the timeout and interval to use when checking for DNS propagation. | |
// Adjusting here to cope with spikes in propagation times. | |
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { | |
return d.config.PropagationTimeout, d.config.PollingInterval | |
} |
Could you add more unit tests:
lego/providers/dns/auroradns/auroradns_test.go
Lines 37 to 147 in a5a2918
func TestNewDNSProvider(t *testing.T) { | |
testCases := []struct { | |
desc string | |
envVars map[string]string | |
expected string | |
}{ | |
{ | |
desc: "success", | |
envVars: map[string]string{ | |
"AURORA_USER_ID": "123", | |
"AURORA_KEY": "456", | |
}, | |
}, | |
{ | |
desc: "missing credentials", | |
envVars: map[string]string{ | |
"AURORA_USER_ID": "", | |
"AURORA_KEY": "", | |
}, | |
expected: "aurora: some credentials information are missing: AURORA_USER_ID,AURORA_KEY", | |
}, | |
{ | |
desc: "missing user id", | |
envVars: map[string]string{ | |
"AURORA_USER_ID": "", | |
"AURORA_KEY": "456", | |
}, | |
expected: "aurora: some credentials information are missing: AURORA_USER_ID", | |
}, | |
{ | |
desc: "missing key", | |
envVars: map[string]string{ | |
"AURORA_USER_ID": "123", | |
"AURORA_KEY": "", | |
}, | |
expected: "aurora: some credentials information are missing: AURORA_KEY", | |
}, | |
} | |
for _, test := range testCases { | |
t.Run(test.desc, func(t *testing.T) { | |
defer envTest.RestoreEnv() | |
envTest.ClearEnv() | |
envTest.Apply(test.envVars) | |
p, err := NewDNSProvider() | |
if len(test.expected) == 0 { | |
require.NoError(t, err) | |
require.NotNil(t, p) | |
require.NotNil(t, p.config) | |
require.NotNil(t, p.client) | |
} else { | |
require.EqualError(t, err, test.expected) | |
} | |
}) | |
} | |
} | |
func TestNewDNSProviderConfig(t *testing.T) { | |
testCases := []struct { | |
desc string | |
userID string | |
key string | |
expected string | |
}{ | |
{ | |
desc: "success", | |
userID: "123", | |
key: "456", | |
}, | |
{ | |
desc: "missing credentials", | |
userID: "", | |
key: "", | |
expected: "aurora: some credentials information are missing", | |
}, | |
{ | |
desc: "missing user id", | |
userID: "", | |
key: "456", | |
expected: "aurora: some credentials information are missing", | |
}, | |
{ | |
desc: "missing key", | |
userID: "123", | |
key: "", | |
expected: "aurora: some credentials information are missing", | |
}, | |
} | |
for _, test := range testCases { | |
t.Run(test.desc, func(t *testing.T) { | |
config := NewDefaultConfig() | |
config.UserID = test.userID | |
config.Key = test.key | |
p, err := NewDNSProviderConfig(config) | |
if len(test.expected) == 0 { | |
require.NoError(t, err) | |
require.NotNil(t, p) | |
require.NotNil(t, p.config) | |
require.NotNil(t, p.client) | |
} else { | |
require.EqualError(t, err, test.expected) | |
} | |
}) | |
} | |
} |
@ldez When implementing Edit: Timeout is now implemented, configurable. |
CI passes now. |
@ldez What else needs to be done to get this PR merged? |
Could you run:
Note, there are 2 domains |
@ldez I've updated the comment. |
I'm annoyed because there is a bug with GitHub (I contacted them on this topic) that prevents me from editing your PR because your fork is in an organization. So there are 3 solutions:
What do you prefer? |
@ldez what do you need the rights for? I think none of these solutions are ideal, maybe the best is to open a PR to the fork. |
I need the rights to apply some review fixes. I opened a PR iMi-digital#1 |
Review 957
@ldez Merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 👍
could you solve this:
|
@ldez Done. |
@ldez How do we proceed to get this in traefik? Should I send a pr after you released a new version of lego? |
yes you have to wait for the next lego release. |
This comment has been minimized.
This comment has been minimized.
@rmoriz Could you open an issue? |
This pr adds support for autodns based on https://help.internetx.com/display/APIJSONEN
Closes #501
Checklist
go mod tidy
Note the wildcard domain is important.