Socket
Book a DemoInstallSign in
Socket

@google-cloud/cloud-sql-connector

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/cloud-sql-connector

A JavaScript library for connecting securely to your Cloud SQL instances

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
830K
78.28%
Maintainers
2
Weekly downloads
 
Created
Source

Cloud SQL Node.js Connector

The Cloud SQL Node.js Connector is a Cloud SQL connector designed for use with the Node.js runtime. Using a Cloud SQL connector provides the following benefits:

  • Improved Security: uses robust, updated TLS 1.3 encryption and identity verification between the client connector and the server-side proxy, independent of the database protocol.
  • Convenience: removes the requirement to use and distribute SSL certificates, as well as manage firewalls or source/destination IP addresses.

The Cloud SQL Node.js Connector is a package to be used alongside a database driver. Currently supported drivers are:

Installation

You can install the library using npm install:

npm install @google-cloud/cloud-sql-connector

Usage

The connector package is meant to be used alongside a database driver, in the following example you can see how to create a new connector and get valid options that can then be used when starting a new pg connection pool.

import pg from 'pg';
import {Connector} from '@google-cloud/cloud-sql-connector';
const { Pool } = pg;

const connector = new Connector();
const clientOpts = await connector.getOptions({
  instanceConnectionName: 'my-project:region:my-instance',
  type: 'PUBLIC'
});
const pool = new Pool({
  ...clientOpts,
  user: 'my-user',
  password: 'my-password',
  database: 'db-name',
  max: 5
});
const result = await pool.query('SELECT NOW()');

await pool.end();
connector.close()

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Versioning

This library follows Semantic Versioning.

This library is considered to be at preview, ready for testing by customers.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

License

Apache Version 2.0

See LICENSE

FAQs

Package last updated on 14 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts