Skip to content

Commit 71c6342

Browse files
committed
disconnect config into userspace
Signed-off-by: Tobias Gurtzick <[email protected]>
1 parent 9736867 commit 71c6342

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

lib/driver/index.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,24 @@ exports.connect = function (config, intern, callback) {
9292
log.verbose('connecting');
9393

9494
var connect = function (config) {
95-
driver.connect(config, intern, function (err, db) {
96-
if (err) {
97-
callback(err);
98-
return;
99-
}
100-
log.verbose('connected');
95+
driver.connect(
96+
// safe disconnect of our config object into userspace
97+
JSON.parse(JSON.stringify(config)),
98+
intern,
99+
function (err, db) {
100+
if (err) {
101+
callback(err);
102+
return;
103+
}
104+
log.verbose('connected');
101105

102-
if (!global.immunity) {
103-
db = Shadow.infect(db, internals, ShadowProto);
104-
}
106+
if (!global.immunity) {
107+
db = Shadow.infect(db, internals, ShadowProto);
108+
}
105109

106-
callback(null, db);
107-
});
110+
callback(null, db);
111+
}
112+
);
108113
};
109114

110115
if (config.tunnel) {
@@ -124,11 +129,12 @@ exports.connect = function (config, intern, callback) {
124129
tunnelConfig.dstPort = config.port;
125130

126131
if (plugin) {
127-
tunnel = plugin[
128-
`connection:tunnel:${
129-
tunnelType && tunnelType !== 'ssh' ? tunnelType : 'ssh'
130-
}`
131-
](tunnelConfig);
132+
tunnel =
133+
plugin[
134+
`connection:tunnel:${
135+
tunnelType && tunnelType !== 'ssh' ? tunnelType : 'ssh'
136+
}`
137+
](tunnelConfig);
132138
}
133139

134140
if (tunnelConfig.privateKeyPath) {

0 commit comments

Comments
 (0)