Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dnslink-cloudflare

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnslink-cloudflare - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

.travis.yml

89

bin/index.js

@@ -6,45 +6,54 @@ #!/usr/bin/env node

yargs.command('$0 zone path', 'Updates the dnslink for a Cloudflare configuration. CF_API_KEY and CF_API_EMAIL environment variables must be set.', yargs => {
yargs.positional('zone', {
describe: 'Name of the zone to update',
type: 'string'
}).positional('path', {
describe: 'IPFS path',
type: 'string'
}).option('record', {
alias: 'r',
describe: 'Name of the record to update',
type: 'string',
default: '@'
}).require(['zone', 'path'])
}, async argv => {
const key = process.env.CF_API_KEY
const email = process.env.CF_API_EMAIL
const argv = yargs
.usage('$0', 'Updates the dnslink for a Cloudflare configuration. CF_API_KEY and CF_API_EMAIL environment variables must be set.')
.scriptName('dnslink-cloudflare')
.option('domain', {
alias: 'd',
describe: 'Cloudflare domain name',
type: 'string',
demandOption: true
}).option('link', {
alias: 'l',
describe: 'dnslink value, eg. ipfs path',
type: 'string',
demandOption: true
}).option('record', {
alias: 'r',
describe: 'Domain record name',
type: 'string',
default: '@'
})
.help()
.argv
if (!key|| !email) {
yargs.showHelp()
return
}
async function run () {
const key = process.env.CF_API_KEY
const email = process.env.CF_API_EMAIL
const api = {
key,
email
}
if (!key || !email) {
yargs.showHelp()
return
}
const opts = {
record: argv.record === '@' ? argv.zone : argv.record,
zone: argv.zone,
path: argv.path
}
const api = {
key,
email
}
try {
const content = await update(api, opts)
const record = opts.record === opts.zone ? '@' : opts.record
console.log(`Updated TXT ${record}.${argv.zone} to ${content}`)
} catch (err) {
console.log(err)
process.exit(1)
}
})
.help()
.argv
const opts = {
record: argv.record === '@' ? argv.domain : argv.record,
zone: argv.domain,
link: argv.link
}
try {
const content = await update(api, opts)
const record = opts.record === opts.zone ? '@' : opts.record
console.log(`Updated TXT ${record}.${opts.zone} to ${content}`)
} catch (err) {
console.log(err)
process.exit(1)
}
}
run()

@@ -27,6 +27,6 @@ const Cloudflare = require('cloudflare')

async function update (apiOpts, { zone, path, record }) {
async function update (apiOpts, { zone, link, record }) {
const api = new Cloudflare(apiOpts)
const id = await getZoneId(api, zone)
const dnslink = `dnslink=${path}`
const dnslink = `dnslink=${link}`
let rec = await getRecord(api, id, record)

@@ -33,0 +33,0 @@

{
"name": "dnslink-cloudflare",
"version": "1.0.3",
"version": "2.0.0",
"description": "Update dnslink TXT records in Cloudflare",

@@ -9,2 +9,5 @@ "main": "./lib/index.js",

},
"scripts": {
"lint": "standard"
},
"author": "Protocol Labs, Inc.",

@@ -16,4 +19,4 @@ "contributors": [

"repository": {
"type" : "git",
"url" : "https://github.com/ipfs-shipyard/dnslink-cloudflare"
"type": "git",
"url": "https://github.com/ipfs-shipyard/dnslink-cloudflare"
},

@@ -23,3 +26,6 @@ "dependencies": {

"yargs": "^13.2.1"
},
"devDependencies": {
"standard": "^12.0.1"
}
}

@@ -11,3 +11,3 @@ # dnslink-cloudflare

```
npx dnslink-cloudflare zone path [-r record]
npx dnslink-cloudflare -d <domain> -l <link> [-r record]
```

@@ -14,0 +14,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc