-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
36 lines (28 loc) · 1.24 KB
/
settings.py
File metadata and controls
36 lines (28 loc) · 1.24 KB
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
32
33
34
35
36
from pathlib import Path
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
# -------------------------------------------------------------------------
# LOGGING
# -------------------------------------------------------------------------
log_level: str = "INFO"
log_file: Path = Path.home() / ".fastapitemplate" / "app.log"
log_file_max_size: int = 25 * 1024 * 1024
log_file_backup_count: int = 7
log_format: str = "%(asctime)s %(levelname)-7s [%(name)s] (%(threadName)s) %(message)s"
# -------------------------------------------------------------------------
# HTTP and CORS
# -------------------------------------------------------------------------
app_host: str = "0.0.0.0"
app_port: int = 8080
cors_origins: list[str] = ["*"]
# -------------------------------------------------------------------------
# DATABASE
# -------------------------------------------------------------------------
database_url: str = "postgresql+asyncpg://appuser:appsecret@127.0.0.1:5432/appdb"
database_pool_pre_ping: bool = True
database_echo: bool = False
model_config = {
"env_file": ".env",
"env_file_encoding": "utf-8",
}
settings = Settings()