Archived
1
0
Fork 0

Add PostgreSQL support (#23)

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-04-06 10:33:24 +02:00
commit 47c8a8ace9
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
10 changed files with 216 additions and 9 deletions

View file

@ -71,6 +71,19 @@ curl -s -XGET "https://api.telegram.org/bot${TOKEN}/sendMessage?chat_id=${CHANNE
Don't forget to prefix the channel name with an `@`.
### Database
Default database driver is SQLite using the `restockbot.db` file.
To configure a PostgreSQL database, you can use Docker:
```
cp -p docker/environment.example docker/environment
docker-compose -f docker-compose.yml up -d
```
Then see the configuration section to define the database configuration.
## Compilation
### With pre-built binaries
@ -116,6 +129,9 @@ Default file is `restockbot.json` in the current directory. The file name can be
Options:
* `database` (optional)
* `type`: driver to use (`postgres`, `sqlite`)
* `dsn`: data source name (see [documentation](https://gorm.io/docs/connecting_to_the_database.html))
* `urls` (optional): list of retailers web pages
* `amazon` (optional)
* `searches`: list of keywords to search for (ex: `["nvidia rtx", "amd rx"]`)