diff --git a/docker-compose.yml b/docker-compose.yml index 1122fb21..68bcfe12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,12 @@ services: restart: always ports: - "2939:8080" + environment: + - "DATABASE_USER=postgres" + - "DATABASE_PASS=postgres" + - "DATABASE_NAME=postgres" + - "DATABASE_HOST=db" + - "DATABASE_PORT=5432" db: image: postgres:alpine volumes: diff --git a/src/api_main.py b/src/api_main.py index 35a89338..d7d37471 100644 --- a/src/api_main.py +++ b/src/api_main.py @@ -1,3 +1,5 @@ +import os + import logging from aiohttp import web @@ -115,7 +117,13 @@ app.add_routes([ async def run(): - app["pool"] = await db.connect() + app["pool"] = await db.connect( + os.environ["DATABASE_USER"], + os.environ["DATABASE_PASS"], + os.environ["DATABASE_NAME"], + os.environ["DATABASE_HOST"], + int(os.environ["DATABASE_PORT"]) + ) return app