Skip to content

Commit

Permalink
Introduce postgres_server as env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nonchris committed Jul 3, 2021
1 parent 91def4c commit e84c2e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Run the bot using `docker-compose` using the image from Docker Hub `nonchris/dis
| TOKEN | yes | Token to run your bot with | - |
| POSTGRES_USER | yes | Username for database | - |
| POSTGRES_PASSWORD | yes | Password to database | - |
| POSTGRES_SERVER | yes | Server the db is located on | - |
| POSTGRES_DB | yes | Name of the database | - |
| PREFIX | no | Prefix the bot listens to | f! |
| VERSION | no | Version displayed by bot | unknown |
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- GID=1000
- POSTGRES_USER=db_user
- POSTGRES_PASSWORD=db_pw
- POSTGRES_SERVER=db
- POSTGRES_DB=db_name
- TOKEN=
- PREFIX=
Expand Down
3 changes: 2 additions & 1 deletion src/database/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@

POSTGRES_USER = os.environ["POSTGRES_USER"]
POSTGRES_PASSWORD = os.environ["POSTGRES_PASSWORD"]
POSTGRES_SERVER = os.environ["POSTGRES_SERVER"]
POSTGRES_DB = os.environ["POSTGRES_DB"]

DB_URL = f"{POSTGRES_USER}:{POSTGRES_PASSWORD}@db/{POSTGRES_DB}"
DB_URL = f"{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_SERVER}/{POSTGRES_DB}"
engine = create_engine(f'postgresql+psycopg2://{DB_URL}', echo=False)


Expand Down

0 comments on commit e84c2e9

Please sign in to comment.