Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #76 from ItsDrike/update-readme
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
Paillat-dev authored Aug 1, 2024
2 parents 2d65c4a + 130f7cf commit 80c2649
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To run the bot, you'll first want to install all of the project's dependencies.
it.

To install the dependencies, you can run the `poetry install` command. If you only want to run the bot and you're not
interested in also developing / contributing, you can also run `poetry install --only-root`, which will skip the
interested in also developing / contributing, you can also run `poetry install --only main`, which will skip the
development dependencies (tools for linting and testing).

Once done, you will want to activate the virtual environment that poetry has just created for the project. To do so,
Expand Down Expand Up @@ -52,34 +52,44 @@ docker compose -f ./docker-compose.local.yaml up

> [!IMPORTANT]
> Note that you will still need to create a `.env` file with all of the configuration variables (see [the configuring
> section](#configuring-the-bot)
> section](#configuring-the-bot))
> [!NOTE]
> By default, the docker container will always use a brand new database. If you wish to persist the database across
> runs, make sure to modify the docker-compose file and mount the database file. In the container, this file will by
> default use the `/app/database.db` path. You can either mount this file from a [docker volume][docker-volumes] or
> from your file-system using a [bind mount][docker-bind-mount].
[docker-volumes]: https://docs.docker.com/storage/volumes/#use-a-volume-with-docker-compose
[docker-bind-mount]: https://docs.docker.com/storage/bind-mounts/#use-a-bind-mount-with-compose

## Configuring the bot

The bot is configured using environment variables. You can either create a `.env` file and define these variables
there, or you can set / export them manually. Using the `.env` file is generally a better idea and will likely be more
convenient.

<!--
TODO: Separate these to variables necessary to run the bot, and those only relevant during development.
-->

| Variable name | Type | Default | Description |
| -------------------------- | ------ | ------------- | ------------------------------------------------------------------------------------------------------------------- |
| `BOT_TOKEN` | string | N/A | Bot token of the discord application (see: [this guide][bot-token-guide] if you don't have one yet) |
| `TVDB_API_KEY` | string | N/A | API key for TVDB (see [this page][tvdb-api-page] if you don't have one yet) |
| `TVDB_RATE_LIMIT_REQUESTS` | int | 5 | Amount of requests that the bot is allowed to make to the TVDB API within `TVDB_RATE_LIMIT_PERIOD` |
| `TVDB_RATE_LIMIT_PERIOD` | float | 5 | Period of time in seconds, within which the bot can make up to `TVDB_RATE_LIMIT_REQUESTS` requests to the TVDB API. |
| `TVDB_RATE_LIMIT_PERIOD` | float | 100 | Period of time in seconds, within which the bot can make up to `TVDB_RATE_LIMIT_REQUESTS` requests to the TVDB API. |
| `SQLITE_DATABASE_FILE` | path | ./database.db | Path to sqlite database file, can be relative to project root (if the file doesn't yet exists, it will be created) |
| `ECHO_SQL` | bool | 0 | If `1`, print out every SQL command that SQLAlchemy library runs internally (can be useful when debugging) |
| `DB_ALWAYS_MIGRATE` | bool | 0 | If `1`, database migrations will always be performed, even on a new database (instead of just creating the tables). |
| `DEBUG` | bool | 0 | If `1`, debug logs will be enabled, if `0` only info logs and above will be shown |
| `LOG_FILE` | path | N/A | If set, also write the logs into given file, otherwise, only print them |
| `TRACE_LEVEL_FILTER` | custom | N/A | Configuration for trace level logging, see: [trace logs config section](#trace-logs-config) |

[bot-token-guide]: https://guide.pycord.dev/getting-started/creating-your-first-bot#creating-the-bot-application
[tvdb-api-page]: https://www.thetvdb.com/api-information

### Debug configuration variables

| Variable name | Type | Default | Description |
| -------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------- |
| `ECHO_SQL` | bool | 0 | If `1`, print out every SQL command that SQLAlchemy library runs internally (can be useful when debugging) |
| `DB_ALWAYS_MIGRATE` | bool | 0 | If `1`, database migrations will always be performed, even on a new database (instead of just creating the tables). |
| `DEBUG` | bool | 0 | If `1`, debug logs will be enabled, if `0` only info logs and above will be shown |
| `LOG_FILE` | path | N/A | If set, also write the logs into given file, otherwise, only print them |
| `TRACE_LEVEL_FILTER` | custom | N/A | Configuration for trace level logging, see: [trace logs config section](#trace-logs-config) |

### Trace logs config

We have a custom `trace` log level for the bot, which can be used for debugging purposes. This level is below `debug`
Expand Down

0 comments on commit 80c2649

Please sign in to comment.