<reponame>regisfbrilhante/challenge-alura-backend
from typing import Optional
from pydantic import BaseSettings


def postgres_uri_factory(settings):
    return f"postgresql+psycopg2://{settings.db_username}:{settings.db_password}@{settings.db_host}/{settings.db_name}"


def sqlite_uri_factory(settings):
    return f"sqlite:///./{settings.db_name}.db"


class Settings(BaseSettings):

    db_host: Optional[str]
    db_username: Optional[str]
    db_password: Optional[str]
    db_name: Optional[str]

    class Config:
        env_file = ".env"


settings = Settings()

from typing import Optional
from pydantic import BaseSettings


def postgres_uri_factory(settings):
    return f"postgresql+psycopg2://{settings.db_username}:{settings.db_password}@{settings.db_host}/{settings.db_name}"


def sqlite_uri_factory(settings):
    return f"sqlite:///./{settings.db_name}.db"


class Settings(BaseSettings):

    db_host: Optional[str]
    db_username: Optional[str]
    db_password: Optional[str]
    db_name: Optional[str]

    class Config:
        env_file = ".env"


settings = Settings()