From 499bb06d3228a11bd8eb42cdbff82f131991da34 Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Fri, 19 Oct 2018 18:36:03 +0200 Subject: [PATCH] Add default keepInterval config option of 30 seconds (issue #49) --- src/connect.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/connect.ts b/src/connect.ts index a3a09a6..e0db840 100644 --- a/src/connect.ts +++ b/src/connect.ts @@ -13,6 +13,11 @@ import { toPromise } from './toPromise'; const SFTPWrapper = require('ssh2/lib/SFTPWrapper') as (new (stream: SFTPStream) => SFTPWrapperReal); type SFTPWrapper = SFTPWrapperReal; +const DEFAULT_CONFIG: ConnectConfig = { + tryKeyboard: true, + keepaliveInterval: 30e3, +} + function replaceVariables(string?: string) { if (typeof string !== 'string') return string; return string.replace(/\$\w+/g, key => process.env[key.substr(1)] || ''); @@ -176,7 +181,7 @@ export async function createSSH(config: FileSystemConfig, sock?: NodeJS.Readable reject(error); }); try { - client.connect(Object.assign(config, { sock, tryKeyboard: true })); + client.connect(Object.assign(config, { sock }, DEFAULT_CONFIG)); } catch (e) { reject(e); }