Skip to content

Commit

Permalink
Address Reviews
Browse files Browse the repository at this point in the history
The changes didn't deserve a different commit
  • Loading branch information
Shivansh-007 committed Nov 17, 2021
1 parent 5e3270a commit e831686
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ services:
tty: true
volumes:
- .:/modmail
env_file:
- .env
environment:
database_uri: postgres://modmail:modmail@postgres:5432/modmail
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ $ psql -qd postgres
Run the following queries to create the user and database:

```psql
CREATE USER voting WITH SUPERUSER PASSWORD 'modmail';
CREATE USER modmail WITH SUPERUSER PASSWORD 'modmail';
CREATE DATABASE modmail WITH OWNER modmail;
```

Expand Down Expand Up @@ -217,7 +217,7 @@ $ poetry run alembic upgrade heads

5. Open the file with any text editor and write the bot token and the database URL to the files in this format:
* `TOKEN="my_token"`.
* `DATABASE_URI=postgresql+asyncpg://modmail:modmail@localhost:5432/modmail`
* `DATABASE_URI=postgres://modmail:modmail@localhost:5432/modmail`

!!! note
If you configured PostgreSQL in a different manner or you are not hosting it locally, then you will need to
Expand Down
7 changes: 3 additions & 4 deletions modmail/bot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import logging
import signal
import sys
import typing as t

import arrow
Expand Down Expand Up @@ -89,10 +90,8 @@ async def init_db(self) -> None:
self.logger.info("Generating database schema via Tortoise...")
await Tortoise.generate_schemas()
except Exception as e:
self.logger.error(
f"DB connection at {CONFIG.bot.sqlalchemy_database_uri} not successful, raised:\n{e}"
)
exit()
self.logger.error(f"DB connection at {CONFIG.bot.database_uri} not successful, raised:\n{e}")
sys.exit(e)

async def start(self, token: str, reconnect: bool = True) -> None:
"""
Expand Down

0 comments on commit e831686

Please sign in to comment.