botbuilder-storage-postgres
v1.1.3
Published
[![Github All Releases](https://img.shields.io/github/downloads/TDAmeritrade/botbuilder-storage-postgres/total.svg)][![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FTDAmeritrade%2Fbotbuilder-storage-postgres.svg?type=shield)](https://
Downloads
23
Readme
State Storage for Bot Framework using Postgres
This project provides a Postgres storage mechanism for Bot Framework-JS SDK V4.
It allows you to store bot state in Postgres, so that you can scale out your bot, and be more resilient to bot server failures.
For more information about the botbuilder community, please visit the botbuilder community project.
Requirements
- NodeJS 10.x is a requirement to install dependencies, build and run tests.
- Postgres database.
Installation
npm install botbuilder-storage-postgres
Sample Usage
const postgresStorage = new PostgresStorage({
uri : process.env.POSTGRES_URI
});
const conversationState = new ConversationState(postgresStorage);
Where POSTGRES_URI
is set in .env
or your secrets store of choice according to LibPQ Connection String standards. E.g.
postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]
Configuration Options
| Field | Description | Value |
| ------------ | -------------------------------------------------------------- | ---------- |
| uri
| The Postgres connection URI | Required |
| collection
| The name you'd like given to the table the bot will reference. | Optional |
| logging
| Whether or not you want logging of transactions enabled. | Optional |
⚠ Caution: you should not store postgres URI in code! Get the
uri
from a configuration such as environment variable or a secrets store in your environment. It may contain sensitive password in the clear and should never be stored in code!
See Postgres Connection URI format in the official documentation to learn more about the connection uri
parameter value.
*
- botbuilder-storage-postgres
- Copyright 2019 TD Ameritrade. Released under the terms of the MIT license.