diff --git a/lib/error.html b/lib/error.html new file mode 100644 index 0000000..f1a8943 --- /dev/null +++ b/lib/error.html @@ -0,0 +1,86 @@ + + + + +
404. That’s an error. +
The requested URL /dns/v1/even-flight-244020/managedZones/supporteasthigh.com/changes
was not found
+ on this server. That’s all we know.
\ No newline at end of file
diff --git a/lib/index.js b/lib/index.js
index 72c44db..81f602e 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -25,13 +25,39 @@ module.exports.create = function(config) {
return resp.body.managedZones.map(function(zone) {
// slice out the leading and trailing single quotes, and the trailing dot
// (assuming that all 'dnsName's probably look the same)
- return zone.dnsName.slice(1, zone.dnsName.length - 2);
+ var name = zone.dnsName.slice(0, zone.dnsName.length - 1);
+ console.log(`the is name ${name}`);
+ return name;
});
});
},
set: function(data) {
- // console.info('Add TXT', data);
+ console.info('Add TXT', data);
+ var ch = data.challenge;
+ return api({
+ method: 'POST',
+ url: baseUrl + '/projects/' + sa.project_id + '/managedZones/' + ch.dnsZone + '/changes',
+ json: {
+ "kind": "dns#change",
+ "additions": [
+ {
+ "kind": "dns#resourceRecordSet",
+ "name": ch.dnsHost,
+ "type": "TXT",
+ "ttl": 300, // TODO test for lowest allowed value
+ "rrdatas": [ ch.dnsAuthorization ],
+ "signatureRrdatas": []
+ }
+ ],
+ "deletions": [],
+ //"startTime": "string",
+ //"id": "string",
+ //"status": "string",
+ //"isServing": true
+ }
+ })
throw Error('setting TXT not implemented');
+
},
remove: function(data) {
// console.info('Remove TXT', data);
@@ -47,7 +73,13 @@ module.exports.create = function(config) {
//return auth.getToken(sa).then(function(token) {
opts.headers = opts.headers || {};
opts.headers.Authorization = 'Bearer ' + token;
- return request(opts);
+ return request(opts).then(function(resp){
+ console.log(resp.headers);
+ console.log(resp.body);
+ return resp
+ }
+
+ );
//});
}