@viadee/nibbler
v0.0.7
Published
Backup and restore PostgreSQL databases in style
Downloads
10
Readme
Nibbler
This little fellow handles backups and restores for your PostgreSQL databases with a handy wizard directly from your terminal.
Usage
To run Nibbler just use npx @viadee/nibbler@latest
. The tool will guide you through the process. Just make sure to create an nibbler.config.js
file in the directory where you want to use Nibbler. The file should look like this:
const config = {
pg: '/usr/local/opt/libpq/bin',
dumps: './dumps',
servers: {
local: {
host: 'localhost',
port: 5432,
username: 'username',
password: 'password',
defaultDb: 'postgres',
},
'managed-server': {
host: 'postgresql-my-hoster.net',
port: 5432,
username: 'username',
password: 'password',
defaultDb: 'postgres',
secure: true,
production: true,
},
},
};
export default config;
The following properties are supported:
| Parameter | Description | Required | Type |
| --------- | ----------------------------------------------------------------------------------------------- | -------- | ------ |
| pg
| The absolute path to where the PostgreSQL binaries like pg_dump
and pg_restore
are located. | yes | string |
| dumps
| The path relative to .env.json
where dumps will be stored. | yes | string |
| servers
| The colleciton of servers to operate with | yes | array |
A server supports following properties:
| Parameter | Description | Required | Type |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
| host
| Host of the PostgreSQL Server | yes | string |
| port
| Port of the PostgreSQL Server | yes | string |
| username
| Username of the PostgreSQL Server | yes | string |
| password
| Password of the PostgreSQL Server | yes | string |
| defaultDb
| Default database of the PostgreSQL Server. This will be used to connect to for creating a new database on restore if neccessary. | yes | string |
| secure
| Flag whether the connection should be secured. | no | boolean |
| production
| Flag to mark a server as production. Nibbler will ask for confirmation before restoring to this server. | no | boolean |