Skip to content

Node wrapper for the google sql cloud proxy

License

Notifications You must be signed in to change notification settings

sipgate/node-cloud-sql-proxy

Repository files navigation

node-cloud-sql-proxy

Node wrapper for the google sql cloud proxy.

Getting started

npm install node-cloud-sql-proxy # or yarn add node-cloud-sql-proxy

Then, connect to the google cloud sql proxy like:

importproxyfrom'node-cloud-sql-proxy';conststartup=async()=>{awaitproxy.connect();// start service}startup()

Connect options

exportinterfaceOptions{dir?: string;instances?: string;quiet?: boolean;gcpCredentialPath?: string;gcpCredentials?: string;}
awaitproxy.connect({quiet: false,instances:"my-project:my-region:my-instance"});

Environment Variables

Any environment variables defined in an .env file will automatically be loaded when running using connecting via the node-cloud-sql-proxy. Variables stored in .env files can be expanded using the format specified by dotenv-expand.

The following table describes which environment variables can be used:

envdescriptionexample
NODE_CLOUD_SQL_DIR-dir Directory when usign unix sockets, the Proxy places the sockets in the directory specified by the -dir parameter/cloudsql
NODE_CLOUD_SQL_INSTANCES-instances To connect to a specific list of instances, set the instances parameter to a comma-separated list of instance connection stringsmy-project:my-region:my-instance
GOOGLE_APPLICATION_CREDENTIALS_PATH-credentials_file If provided, this json file will be used to retrieve Service Account credentials. You may set the GOOGLE_APPLICATION_CREDENTIALS environment variable for the same effect./tmp/google_credentials.json
GOOGLE_APPLICATION_CREDENTIALSIf provided, this json file will be used to retrieve Service Account credentials./tmp/google_credentials.json

About

Node wrapper for the google sql cloud proxy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •