From d79a97a48464619f29a6d6103384ae36c6c2dcab Mon Sep 17 00:00:00 2001 From: Felix Kiss Date: Sun, 10 Apr 2016 04:28:10 +0200 Subject: [PATCH] Make privateKeyFile optional This is necessary in order to use the `agent` option, because SSH2 will ignore `agent` if a `privateKeyFile` is set as well. --- index.js | 3 ++- lib/ssh.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 5459781..ae2b0a0 100644 --- a/index.js +++ b/index.js @@ -15,6 +15,7 @@ module.exports = { allowOverwrite: false, filePattern: 'index.html', port: 22, + privateKeyFile: null, agent: null, passphrase: null, distDir: function(context) { @@ -26,7 +27,7 @@ module.exports = { } }, - requiredConfig: ['username', 'host', 'port', 'remoteDir', 'privateKeyFile'], + requiredConfig: ['username', 'host', 'port', 'remoteDir'], upload: function(context) { var allowOverwrite = this.readConfig('allowOverwrite'); diff --git a/lib/ssh.js b/lib/ssh.js index fe84847..d950315 100644 --- a/lib/ssh.js +++ b/lib/ssh.js @@ -131,7 +131,7 @@ module.exports = CoreObject.extend({ port: options.port || '22', agent: options.agent, passphrase: options.passphrase, - privateKey: fs.readFileSync(untildify(options.privateKeyFile)) + privateKey: options.privateKeyFile ? fs.readFileSync(untildify(options.privateKeyFile)) : null }; return new Promise(function(resolve, reject) {