Skip to content

Commit 3aa0ef0

Browse files
Aaron Suarezapex-omontgomery
Aaron Suarez
authored andcommitted
Add POSTGRES_URL (#146)
1 parent b08b7bd commit 3aa0ef0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

configs.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ def get_sys_exec_root_or_drive():
2828
if not postgres_db:
2929
raise KeyError("Application requires 'POSTGRES_DB' to run")
3030

31+
postgres_host = os.environ.get('POSTGRES_HOST')
32+
if not postgres_host:
33+
raise KeyError("Application requires 'POSTGRES_HOST' to run")
34+
3135

3236
class Config:
3337
SQLALCHEMY_TRACK_MODIFICATIONS = False
34-
SQLALCHEMY_DATABASE_URI = f"postgresql://{postgres_user}:{postgres_password}@{postgres_db}:5432/{postgres_db}"
38+
SQLALCHEMY_DATABASE_URI = f"postgresql://{postgres_user}:{postgres_password}@{postgres_host}:5432/{postgres_db}"
3539

3640
# Can pass in changes to defaults, such as PaginatorConfig(per_page=40)
3741
RESOURCE_PAGINATOR = PaginatorConfig()

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ services:
2323
- POSTGRES_USER=${POSTGRES_USER}
2424
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
2525
- POSTGRES_DB=${POSTGRES_DB}
26+
- POSTGRES_HOST=${POSTGRES_HOST}
2627
ports:
2728
- 5432:5432
2829
volumes:

0 commit comments

Comments
 (0)