-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
31 lines (23 loc) · 748 Bytes
/
config.py
File metadata and controls
31 lines (23 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import logging
from pydantic import BaseSettings
from sqlalchemy.engine import URL # type: ignore
class Config(BaseSettings):
APP_PORT: int = 5000
APP_HOST: str = "0.0.0.0"
DB_HOST: str = "localhost"
DB_USERNAME: str = "postgres"
DB_PASSWORD: str = "postgres"
DB_DATABASE: str = "register"
DB_ECHO: bool = True
LOG_LEVEL: int = logging.INFO
@property
def DATABASE_URI(self):
return URL.create(
drivername="postgresql+asyncpg",
username=self.DB_USERNAME,
password=self.DB_PASSWORD,
host=self.DB_HOST,
database=self.DB_DATABASE,
)
settings = Config()
logger = logging.Logger(name="fastapi_sandbox", level=settings.LOG_LEVEL)