Compare commits

...

4 Commits

Author SHA1 Message Date
AJ ONeal 9b6d363328 v3.0.2: doc and test updates 2019-07-16 11:59:48 -06:00
AJ ONeal 6676b6412d Merge branch 'master' of ssh://git.coolaj86.com:22042/coolaj86/acme-dns-01-vultr.js 2019-07-03 22:35:25 -06:00
AJ ONeal 5b9417dc44 v3.0.1: fix link typo 2019-07-03 22:34:54 -06:00
nyaundi brian c8087a7f53 typo fix 2019-06-16 17:04:20 +03:00
7 changed files with 36 additions and 24 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.env
*secret* *secret*
node_modules node_modules

View File

@ -1,4 +1,4 @@
# [acme-dns-01-vultr](https://git.rootprojects.org/root/acme-dns-01-vultr.js) | a [Root](https://rootrpojects.org) project # [acme-dns-01-vultr](https://git.rootprojects.org/root/acme-dns-01-vultr.js) | a [Root](https://rootprojects.org) project
Vultr DNS + Let's Encrypt for Node.js Vultr DNS + Let's Encrypt for Node.js
@ -13,12 +13,12 @@ npm install --save acme-dns-01-vultr@3.x
# Usage # Usage
First you create an instance with your credentials: First you create an instance with your API token:
```js ```js
var dns01 = require('acme-dns-01-vultr').create({ var dns01 = require('acme-dns-01-vultr').create({
baseUrl: 'https://api.vultr.com/v1/dns', // default baseUrl: 'https://api.vultr.com/v1/dns', // default
apiKey: 'xxxx' token: 'xxxx'
}); });
``` ```
@ -55,14 +55,14 @@ dns01
.set({ .set({
identifier: { value: 'foo.example.com' }, identifier: { value: 'foo.example.com' },
wildcard: false, wildcard: false,
dnsHost: '_acme-challenge.foo.example.com' dnsHost: '_acme-challenge.foo.example.com',
dnsAuthorization: 'xxx_secret_xxx' dnsAuthorization: 'xxx_secret_xxx'
}) })
.then(function() { .then(function() {
console.log("TXT record set"); console.log('TXT record set');
}) })
.catch(function() { .catch(function() {
console.log("Failed to set TXT record"); console.log('Failed to set TXT record');
}); });
``` ```

2
example.env Normal file
View File

@ -0,0 +1,2 @@
ZONE=example.co.uk
TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

View File

@ -9,7 +9,9 @@ var defaults = {
module.exports.create = function(config) { module.exports.create = function(config) {
var baseUrl = (config.baseUrl || defaults.baseUrl).replace(/\/$/, ''); var baseUrl = (config.baseUrl || defaults.baseUrl).replace(/\/$/, '');
var apiKey = config.apiKey; // In all of the other modules the API token is called token,
// but here we support both.
var apiKey = config.token || config.apiKey;
function api(method, path, form) { function api(method, path, form) {
return request({ return request({

8
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "acme-dns-01-vultr", "name": "acme-dns-01-vultr",
"version": "3.0.0", "version": "3.0.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -23,6 +23,12 @@
"requires": { "requires": {
"acme-challenge-test": "^3.2.0" "acme-challenge-test": "^3.2.0"
} }
},
"dotenv": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.0.0.tgz",
"integrity": "sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg==",
"dev": true
} }
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "acme-dns-01-vultr", "name": "acme-dns-01-vultr",
"version": "3.0.0", "version": "3.0.2",
"description": "Vultr DNS for Let's Encrypt / ACME dns-01 challenges with ACME.js and Greenlock.js", "description": "Vultr DNS for Let's Encrypt / ACME dns-01 challenges with ACME.js and Greenlock.js",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -24,6 +24,7 @@
"@root/request": "^1.3.11" "@root/request": "^1.3.11"
}, },
"devDependencies": { "devDependencies": {
"acme-dns-01-test": "^3.2.1" "acme-dns-01-test": "^3.2.1",
"dotenv": "^8.0.0"
} }
} }

10
test.js Normal file → Executable file
View File

@ -1,13 +1,14 @@
#!/usr/bin/env node #!/usr/bin/env node
'use strict'; 'use strict';
// https://git.rootprojects.org/root/acme-dns-01-test.js // See https://git.coolaj86.com/coolaj86/acme-challenge-test.js
var tester = require('acme-dns-01-test'); var tester = require('acme-challenge-test');
require('dotenv').config();
// Usage: node ./test.js example.com xxxxxxxxx // Usage: node ./test.js example.com xxxxxxxxx
var zone = process.argv[2]; var zone = process.argv[2] || process.env.ZONE;
var challenger = require('./index.js').create({ var challenger = require('./index.js').create({
apiKey: process.argv[3] token: process.argv[3] || process.env.TOKEN
}); });
// The dry-run tests can pass on, literally, 'example.com' // The dry-run tests can pass on, literally, 'example.com'
@ -18,7 +19,6 @@ tester
console.info('PASS', zone); console.info('PASS', zone);
}) })
.catch(function(e) { .catch(function(e) {
console.info('FAIL', zone);
console.error(e.message); console.error(e.message);
console.error(e.stack); console.error(e.stack);
}); });