Skip to content

Commit

Permalink
docs: include pg and pool usage examples (#17)
Browse files Browse the repository at this point in the history
* docs: include `pg` and `pool` usage examples

* docs: improve usage examples

* docs: improve names

* docs: improve comments

* docs: add table of contents
  • Loading branch information
wellwelwel committed Apr 21, 2024
1 parent 90d219e commit 1f68018
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 3 deletions.
94 changes: 91 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
# AWS SSL Profiles

[**AWS RDS**](https://aws.amazon.com/rds/) Certificates Bundles.
[**AWS RDS**](https://aws.amazon.com/rds/) **SSL** Certificates Bundles.

## Install
**Table of Contents**

- [Installation](#installation)
- [Usage](#usage)
- [**mysqljs/mysql**](#mysqljsmysql)
- [**MySQL2**](#mysql2)
- [**node-postgres**](#node-postgres)
- [Custom `ssl` options](#custom-ssl-options)
- [License](#license)
- [Security](#security)
- [Contributing](#contributing)
- [Acknowledgements](#acknowledgements)

---

## Installation

```bash
npm install --save aws-ssl-profiles
Expand All @@ -12,14 +27,87 @@ npm install --save aws-ssl-profiles

## Usage

### [mysqljs/mysql](https://github.com/mysqljs/mysql)

```js
const mysql = require('mysql');
const awsCaBundle = require('aws-ssl-profiles');

// mysql or mysql2 connection
// mysql connection
const connection = mysql.createConnection({
//...
ssl: awsCaBundle,
});

// mysql connection pool
const pool = mysql.createPool({
//...
ssl: awsCaBundle,
});
```

### [MySQL2](https://github.com/sidorares/node-mysql2)

```js
const mysql = require('mysql2');
const awsCaBundle = require('aws-ssl-profiles');

// mysql2 connection
const connection = mysql.createConnection({
//...
ssl: awsCaBundle,
});

// mysql2 connection pool
const pool = mysql.createPool({
//...
ssl: awsCaBundle,
});
```

### [node-postgres](https://github.com/brianc/node-postgres)

```js
const pg = require('pg');
const awsCaBundle = require('aws-ssl-profiles');

// pg connection
const client = new pg.Client({
// ...
ssl: awsCaBundle,
});

// pg connection pool
const pool = new pg.Pool({
// ...
ssl: awsCaBundle,
});
```

### Custom `ssl` options

Using **AWS SSL Profiles** with custom `ssl` options:

```js
{
// ...
ssl: {
...awsCaBundle,
rejectUnauthorized: true,
// ...
}
}
```

```js
{
// ...
ssl: {
ca: awsCaBundle.ca,
rejectUnauthorized: true,
// ...
}
}
```

---
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@
"keywords": [
"mysql",
"mysql2",
"pg",
"postgres",
"aws",
"rds",
"ssl",
"certificates",
"ca",
"bundle"
],
"scripts": {
Expand Down

0 comments on commit 1f68018

Please sign in to comment.