|
import os |
|
from pathlib import Path |
|
from dotenv import load_dotenv |
|
from urllib.parse import quote_plus |
|
from pydantic_settings import BaseSettings |
|
|
|
load_dotenv() |
|
|
|
|
|
class Settings(BaseSettings): |
|
DATABASE_NAME: str = os.getenv("PG_NAME") |
|
DATABASE_USER: str = os.getenv("PG_USER") |
|
DATABASE_PASSWORD: str = os.getenv("PG_PASSWORD") |
|
DATABASE_HOST: str = os.getenv("PG_HOST") |
|
DATABASE_PORT: str = os.getenv("PG_PORT") |
|
DATABASE_URL = f"postgresql://{DATABASE_USER}:{quote_plus(DATABASE_PASSWORD)}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}" |
|
JWT_SECRET_KEY: str = os.getenv("JWT_SECRET") |
|
JWT_ALGORITHM: str = os.getenv("JWT_ALGORITHM") |
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = os.getenv("ACCESS_TOKEN") |
|
|
|
def get_settings(): |
|
return Settings() |