Skip to content

Commit

Permalink
Merge pull request #12 from torus-tools/publish_fixes
Browse files Browse the repository at this point in the history
Publish fixes
  • Loading branch information
gkpty authored Sep 12, 2020
2 parents 644cb24 + 6955304 commit 64ee190
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
5 changes: 3 additions & 2 deletions lib/nameservers/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function aws(domain, nameservers){
//GoDaddy
function godaddy(domain, nameservers){
return new Promise((resolve, reject) => {
//console.log('EXECUTING NAMESERVER UPDATE ', domain, nameservers)
var url = `https://api.godaddy.com/v1/domains/${domain}`
axios({
method: 'patch',
Expand All @@ -37,8 +38,8 @@ function godaddy(domain, nameservers){
"nameServers": nameservers
}
})
.then(res => resolve(res.data))
.catch(err => reject(err))
.then(response => resolve(response.data))
.catch(error => reject(error))
})
}

Expand Down
19 changes: 11 additions & 8 deletions lib/records/deleteAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ function aws(domain){
)
}
}
var params = {
ChangeBatch: {
Changes: changes
},
HostedZoneId: id
if(changes.length > 0){
var params = {
ChangeBatch: {
Changes: changes
},
HostedZoneId: id
}
route53.changeResourceRecordSets(params).promise()
.then(data => resolve(data))
.catch(err => reject(err))
}
route53.changeResourceRecordSets(params).promise()
.then(data => resolve(data))
.catch(err => reject(err))
else resolve('No records to delete')
})
}).catch(err=>reject(err))
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@torus-tools/domains",
"version": "0.0.12",
"version": "0.0.14",
"description": "A standrad promise-based SDK for managing nameserver and DNS operations accorss multiple domain name registrars",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions test/deleteAllRecordsTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const deleteAllRecords = require('../lib/records/deleteAll')

deleteAllRecords.aws('localizehtml.com')
.then(data => console.log(data))
.catch(err => console.log(err))
12 changes: 7 additions & 5 deletions test/updateNameserversTest.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const dns = require('../index')

const ns = [
'ns-95.awsdns-54.net',
'ns-260.awsdns-43.com',
'ns-1873.awsdns-31.co.uk',
'ns-1050.awsdns-02.org'
'ns-822.awsdns-38.net',
'ns-19.awsdns-02.com',
'ns-1238.awsdns-26.org',
'ns-2034.awsdns-62.co.uk'
]
dns.godaddy.updateNameServers('localizehtml.com', ns).then(data=>console.log(data)).catch(err=>console.log(err))

dns.godaddy.updateNameservers('localizehtml.com', ns)
.then(data=>console.log(data)).catch(err=>console.log(err))
//updateNameServers.aws('torusframework.com', ns).then(data=>console.log(data)).catch(err=>console.log(err))

0 comments on commit 64ee190

Please sign in to comment.