Skip to content

Commit

Permalink
feat: [OD15-13] Set local DB_HOST to localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
therealjamesjung committed Oct 12, 2022
1 parent 7cd39a0 commit 696b214
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
from pydantic import BaseSettings
from dotenv import dotenv_values

env = dotenv_values('.env')
if dotenv_values('.env'):
env = dotenv_values('.env')
env['DB_HOST'] = '127.0.0.1'
else:
env = os.environ


DB_URI = 'postgresql://' + \
f'{os.environ.get("DB_USERNAME")}:{os.environ.get("DB_PASSWORD")}' + \
f'@{os.environ.get("DB_HOST")}:{os.environ.get("DB_PORT")}/{os.environ.get("DB_NAME")}'
f'{env.get("DB_USERNAME")}:{env.get("DB_PASSWORD")}' + \
f'@{env.get("DB_HOST")}:{env.get("DB_PORT")}/{env.get("DB_NAME")}'


class Settings(BaseSettings):
Expand Down

0 comments on commit 696b214

Please sign in to comment.