Testys commited on
Commit
e1c6d87
1 Parent(s): 7dfe74a

Update core/config.py

Browse files
Files changed (1) hide show
  1. core/config.py +7 -10
core/config.py CHANGED
@@ -4,19 +4,16 @@ from dotenv import load_dotenv
4
  from urllib.parse import quote_plus
5
  from pydantic_settings.base import BaseSettingsModel
6
 
7
- env_path = Path('.') / '.env'
8
- load_dotenv(dotenv_path=env_path)
9
 
10
 
11
  class Settings(BaseSettingsModel):
12
- # DATABASE_URL: str
13
- # DATABASE_NAME: str
14
- # DATABASE_USER: str
15
- # DATABASE_PASSWORD: str
16
- # DATABASE_HOST: str
17
- # DATABASE_PORT: str
18
- # DATABASE_URL: str
19
- # DATABASE_URL = f"postgresql://{DATABASE_USER}:{quote_plus(DATABASE_PASSWORD)}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}"
20
  JWT_SECRET_KEY: str = os.getenv("JWT_SECRET")
21
  JWT_ALGORITHM: str = os.getenv("JWT_ALGORITHM")
22
  ACCESS_TOKEN_EXPIRE_MINUTES: int = os.getenv("ACCESS_TOKEN")
 
4
  from urllib.parse import quote_plus
5
  from pydantic_settings.base import BaseSettingsModel
6
 
7
+ load_dotenv()
 
8
 
9
 
10
  class Settings(BaseSettingsModel):
11
+ DATABASE_NAME: str = os.getenv("PG_NAME")
12
+ DATABASE_USER: str = os.getenv("PG_USER")
13
+ DATABASE_PASSWORD: str = os.getenv("PG_PASSWORD")
14
+ DATABASE_HOST: str = os.getenv("PG_HOST")
15
+ DATABASE_PORT: str = os.getenv("PG_PORT")
16
+ DATABASE_URL = f"postgresql://{DATABASE_USER}:{quote_plus(DATABASE_PASSWORD)}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}"
 
 
17
  JWT_SECRET_KEY: str = os.getenv("JWT_SECRET")
18
  JWT_ALGORITHM: str = os.getenv("JWT_ALGORITHM")
19
  ACCESS_TOKEN_EXPIRE_MINUTES: int = os.getenv("ACCESS_TOKEN")