33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
#!/usr/bin/env node
|
|
'use strict'
|
|
|
|
// https://git.rootprojects.org/root/acme-dns-01-test.js
|
|
const tester = require('acme-dns-01-test')
|
|
|
|
// Usage: node ./test.js example.com you@example.com key xxxxxxxxx
|
|
// Usage: node ./test.js example.com you@example.com token xxxxxxxxx
|
|
// Usage: node ./test.js example.com you@example.com token xxxxxxxxx yyyyyyy
|
|
const [zone, authEmail, authType, credential, zoneToken] = process.argv.slice(2)
|
|
const config = { authEmail }
|
|
switch (authType) {
|
|
case 'token':
|
|
config.bearerTokens = { list: credential, zone: zoneToken || credential }
|
|
break
|
|
default:
|
|
config.authKey = credential
|
|
}
|
|
const challenger = require('./index.js').create(config)
|
|
|
|
// The dry-run tests can pass on, literally, 'example.com'
|
|
// but the integration tests require that you have control over the domain
|
|
tester
|
|
.testZone('dns-01', zone, challenger)
|
|
.then(function () {
|
|
console.info('PASS', zone)
|
|
})
|
|
.catch(function (e) {
|
|
console.info('FAIL', zone)
|
|
console.error(e.message)
|
|
console.error(e.stack)
|
|
})
|