From 7d899a7f04ca9fc56b679221f4a23130cfe490a7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 25 Sep 2015 08:07:08 +0000 Subject: [PATCH] add another option --- ddns-client.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ddns-client.js b/ddns-client.js index 38169cd..b883077 100755 --- a/ddns-client.js +++ b/ddns-client.js @@ -14,7 +14,7 @@ cli.parse({ , insecure: [ false, '(deprecated) allow insecure non-https connections', 'boolean' ] , cacert: [ false, '(not implemented) specify a CA for "self-signed" https certificates', 'string' ] , answer: [ 'a', 'The answer', 'string' ] -, token: [ false, 'Token', 'string' ] +, token: [ false, 'Token (TODO or filepath to token)', 'string' ] }); cli.main(function (args, options) { @@ -23,8 +23,9 @@ cli.main(function (args, options) { options.answer = options.answer || args[1] if (options.insecure) { - console.error('--insecure is not supported. You must use secure connections.'); - return; + //console.error('--insecure is not supported. You must use secure connections.'); + //return; + options.cacert = false; } if (!options.hostname) { @@ -42,6 +43,7 @@ cli.main(function (args, options) { updater: options.service , port: options.port , cacert: options.cacert + , token: options.token , ddns: [ { "name": options.hostname , "value": options.answer @@ -52,7 +54,11 @@ cli.main(function (args, options) { ] }).then(function (data) { if ('string') { - data = JSON.parse(data); + try { + data = JSON.parse(data); + } catch(e) { + console.error(data); + } } console.log(JSON.stringify(data, null, ' '));