Socket
Socket
Sign inDemoInstall

mongodb-aws-documentdb-tunneling

Package Overview
Dependencies
45
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-alpha.24 to 1.0.0-alpha.28

12

clients/mongodb.local.client.js
const MONGODB = require('mongodb')
const JOI = require('joi')
const HTTPError = require('node-http-error')
const DEBUG = require('debug')('mongodb-aws-documentdb-tunneling.local')

@@ -12,2 +13,4 @@

DEBUG('Connecting to local MongoDB.')
const optionsValidation = JOI

@@ -22,3 +25,3 @@ .object()

.validate(options, { allowUnknown: true })
if (optionsValidation.error) return Promise.reject(optionsValidation.error)
if (optionsValidation.error) throw optionsValidation.error

@@ -42,5 +45,6 @@ /**

.catch(
error => Promise.reject({
message: 'Error. Could not connect to local MongoDB.', error,
})
error => Promise.reject(new HTTPError(
500, 'Error. Could not connect to local MongoDB.',
{ error, uri, mongodbOptions },
))
)

@@ -47,0 +51,0 @@ }

@@ -5,2 +5,3 @@ const MONGODB = require('mongodb')

const JOI = require('joi')
const HTTPError = require('node-http-error')
const DEBUG = require('debug')('mongodb-aws-documentdb-tunneling.remote')

@@ -15,2 +16,4 @@

DEBUG('Connecting to remote MongoDB.')
const optionsValidation = JOI

@@ -36,3 +39,3 @@ .object()

.validate(options)
if (optionsValidation.error) return Promise.reject(optionsValidation.error)
if (optionsValidation.error) throw optionsValidation.error

@@ -51,2 +54,4 @@ return options.makeTunnel

DEBUG('Client is outside VPC, connecting to cluster through SSH tunnel.')
const tunnelConfigurations = {

@@ -64,3 +69,5 @@ username: options.vpcTunnelEC2Username,

.catch(err => err)
if (tunnel instanceof Error) return Promise.reject(tunnel)
if (tunnel instanceof Error) return Promise.reject(
new HTTPError(500, 'Error. Could not create SSH tunnel.', { error: tunnel, options })
)

@@ -94,9 +101,11 @@ DEBUG(`Tunnel listening on port ${options.vpcTunnelEC2PortLocal}.`)

client => Promise.resolve({
message: 'Connected to DocumentDB through our EC2 ssh tunnel with MongoDB.', client,
message: 'Connected to remote DocumentDB through our EC2 ssh tunnel with MongoDB.',
client: client,
})
)
.catch(
error => Promise.reject({
message: 'Error. Could not connect to DocumentDB through our EC2 ssh tunnel with MongoDB.', uri, error,
})
error => Promise.reject(new HTTPError(
500, 'Error. Could not connect to remote DocumentDB through our EC2 ssh tunnel with MongoDB.',
{ error, uri, mongoDBOptions },
))
)

@@ -118,2 +127,4 @@ }

DEBUG('Client is inside VPC, connecting directly to cluster.')
/**

@@ -136,9 +147,11 @@ * @type {MONGODB.MongoClientOptions} MongoDB connection options.

client => Promise.resolve({
message: 'Connected to DocumentDB with MongoDB.', client: client,
message: 'Connected to remote DocumentDB with MongoDB.',
client: client,
})
)
.catch(
error => Promise.reject({
message: 'Error. Could not connect to DocumentDB with MongoDB.', error, uri,
})
error => Promise.reject(new HTTPError(
500, 'Error. Could not connect to remote DocumentDB with MongoDB.',
{ error, uri, mongoDBOptions },
))
)

@@ -145,0 +158,0 @@ }

{
"name": "mongodb-aws-documentdb-tunneling",
"version": "1.0.0-alpha.24",
"version": "1.0.0-alpha.28",
"description": "Mongodb wich allow SSH tunneling into a AWS documentDb VPC by going through a EC2 instance hosted in the same VPC.",

@@ -15,2 +15,3 @@ "main": "index.js",

"mongodb": "^3.1.13",
"node-http-error": "^2.0.0",
"tunnel-ssh": "^4.1.4"

@@ -25,3 +26,3 @@ },

},
"gitHead": "cc73cabb977cabf02e3dcffee1b92c65231fd69b"
"gitHead": "51f3c764dd07106c332ddf3084d0ad9dafd0c3a8"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc