-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
50 lines (41 loc) · 1.16 KB
/
config.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import datetime
from functools import cache
from pathlib import Path
from pydantic import (
ConfigDict, FilePath,
PostgresDsn,
RedisDsn,
SecretStr,
)
from pydantic_settings import BaseSettings
__all__ = (
'settings',
'get_settings',
'Settings',
)
class Settings(BaseSettings):
"""
Базовые настройки проекта.
"""
pg_dsn: PostgresDsn
pg_dsn_direct: PostgresDsn
redis_dsn: RedisDsn
secret_string: SecretStr
debug: bool = False
root_path: Path = Path(__file__).resolve().parent
# logging_config_file_path: FilePath = 'internal/logging/configuration.yaml'
access_token_expire_minutes: int = 10000000
obtain_jwt_token_ratelimit: str = '10/minute'
user_cache_persistence: datetime.timedelta = datetime.timedelta(minutes=60)
redis_socket_connection_timeout: float = 0.5
redis_socket_timeout: float = 0.5
grpc_port: str
model_config = ConfigDict(extra='ignore')
@cache
def get_settings() -> Settings:
"""
Отдает базовые настройки проекта.
:return: Settings
"""
return Settings()
settings: Settings = get_settings()