diff --git a/lib/modem.js b/lib/modem.js index 846d98b..60ec49e 100644 --- a/lib/modem.js +++ b/lib/modem.js @@ -90,6 +90,11 @@ var Modem = function (options) { this.headers = opts.headers || {}; this.sshOptions = Object.assign({}, options ? options.sshOptions : {}, optDefaults.sshOptions); + // Support sshAuthAgent for backwards-compatibility with d2f92b22cf284d537a57cc255ba11b4c4c5d7b61 + if (options && options.sshAuthAgent) { + this.sshOptions.agent = options.sshAuthAgent; + } + if (this.key && this.cert && this.ca) { this.protocol = 'https'; } diff --git a/test/modem_test.js b/test/modem_test.js index 1de08e2..640eaea 100644 --- a/test/modem_test.js +++ b/test/modem_test.js @@ -169,4 +169,14 @@ describe('Modem', function() { assert.strictEqual(modem.sshOptions.agent, '/var/lib/sock'); assert.strictEqual(modem.sshOptions.foo, 'bar'); }); + + it('supports custom sshAuthAgent for backwards-compatibility', function() { + process.env.DOCKER_HOST = 'ssh://user@192.168.59.105:5555'; + process.env.SSH_AUTH_SOCK = '/var/lib/sock'; + + var modem = new Modem({ + sshAuthAgent: '/var/lib/custom_agent', + }); + assert.strictEqual(modem.sshOptions.agent, '/var/lib/custom_agent'); + }); });