UNPKG

mongodb-data-service

Version:
27 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.waitForTunnelError = waitForTunnelError; exports.getTunnelOptions = getTunnelOptions; async function waitForTunnelError(tunnel) { return new Promise((_, reject) => { tunnel?.on('error', reject); }); } function getTunnelOptions(connectionOptions, appLevelProxyOptions) { if (connectionOptions.useApplicationLevelProxy) { return appLevelProxyOptions; } if (connectionOptions.sshTunnel) { const { host, port, username, password, identityKeyFile, identityKeyPassphrase, } = connectionOptions.sshTunnel; return { proxy: `ssh://${username ? encodeURIComponent(username) + (password ? ':' + encodeURIComponent(password) : '') + '@' : ''}${encodeURIComponent(host)}:${encodeURIComponent(+port || 22)}`, sshOptions: { identityKeyFile, identityKeyPassphrase }, }; } return {}; } //# sourceMappingURL=ssh-tunnel-helpers.js.map