Add PostgreSQL support (#23)
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
b6f23d4bd5
commit
47c8a8ace9
10 changed files with 216 additions and 9 deletions
16
README.md
16
README.md
|
|
@ -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"]`)
|
||||
|
|
|
|||
Reference in a new issue