forked from TrueCloudLab/lego
b90b31980a
This commit adds support for Dyn, specifically Dyn Managed DNS. Makes use of the Dyn REST API [1] and requires 3 environment variables for credentails: DYN_CUSTOMER_NAME DYN_USER_NAME DYN_PASSWORD The Dyn DNS API requires a session to be established first using the credentials above, After creating a session an api token is used for subsequent requests. The unit test performs a "live test" and currently requires a valid Dyn account and domain. [1] https://help.dyn.com/rest/
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package acme
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
var (
|
|
dynLiveTest bool
|
|
dynCustomerName string
|
|
dynUserName string
|
|
dynPassword string
|
|
dynDomain string
|
|
)
|
|
|
|
func init() {
|
|
dynCustomerName = os.Getenv("DYN_CUSTOMER_NAME")
|
|
dynUserName = os.Getenv("DYN_USER_NAME")
|
|
dynPassword = os.Getenv("DYN_PASSWORD")
|
|
dynDomain = os.Getenv("DYN_DOMAIN")
|
|
if len(dynCustomerName) > 0 && len(dynUserName) > 0 && len(dynPassword) > 0 && len(dynDomain) > 0 {
|
|
dynLiveTest = true
|
|
}
|
|
}
|
|
|
|
func TestLiveDynPresent(t *testing.T) {
|
|
if !dynLiveTest {
|
|
t.Skip("skipping live test")
|
|
}
|
|
|
|
provider, err := NewDNSProviderDyn(dynCustomerName, dynUserName, dynPassword)
|
|
assert.NoError(t, err)
|
|
|
|
err = provider.Present(dynDomain, "", "123d==")
|
|
assert.NoError(t, err)
|
|
}
|
|
|
|
func TestLiveDynCleanUp(t *testing.T) {
|
|
if !dynLiveTest {
|
|
t.Skip("skipping live test")
|
|
}
|
|
|
|
time.Sleep(time.Second * 1)
|
|
|
|
provider, err := NewDNSProviderDyn(dynCustomerName, dynUserName, dynPassword)
|
|
assert.NoError(t, err)
|
|
|
|
err = provider.CleanUp(dynDomain, "", "123d==")
|
|
assert.NoError(t, err)
|
|
}
|