Browse Source

Add a flag for skipping DNS verification (#94)

Some registrars requires that the DNS records are already setup
before delegating the domain to a nameserver.
master
Olli Vanhoja 8 years ago
committed by Tony Kovanen
parent
commit
530a9fb357
  1. 6
      bin/now-domains.js
  2. 6
      lib/domains.js

6
bin/now-domains.js

@ -16,11 +16,12 @@ import NowDomains from '../lib/domains'
const argv = minimist(process.argv.slice(2), {
string: ['config', 'token'],
boolean: ['help', 'debug'],
boolean: ['help', 'debug', 'force'],
alias: {
help: 'h',
config: 'c',
debug: 'd',
force: 'f',
token: 't'
}
})
@ -36,6 +37,7 @@ const help = () => {
-h, --help Output usage information
-c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file
-d, --debug Debug mode [off]
-f, --force Skip DNS verification
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token
${chalk.dim('Examples:')}
@ -207,7 +209,7 @@ async function run(token) {
const start = new Date()
const name = String(args[0])
const {uid, created} = await domain.add(name)
const {uid, created} = await domain.add(name, argv.force)
const elapsed = ms(new Date() - start)
if (created) {
console.log(`${chalk.cyan('> Success!')} Domain ${chalk.bold(chalk.underline(name))} ${chalk.dim(`(${uid})`)} added [${elapsed}]`)

6
lib/domains.js

@ -50,13 +50,17 @@ export default class Domains extends Now {
})
}
async add(domain) {
async add(domain, skipVerification) {
if (!domainRegex.test(domain)) {
const err = new Error(`The supplied value ${chalk.bold(`"${domain}"`)} is not a valid domain.`)
err.userError = true
throw err
}
if (skipVerification) {
return this.setupDomain(domain)
}
let ns
try {

Loading…
Cancel
Save