Fix parsing phone and add redis storage for FSM in telegram bot
This commit is contained in:
22
birthday_pool_bot/telegram_bot/storage/settings.py
Normal file
22
birthday_pool_bot/telegram_bot/storage/settings.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from .enums import StorageTypeEnum
|
||||
|
||||
|
||||
class StorageSettings(BaseModel):
|
||||
type: StorageTypeEnum
|
||||
|
||||
|
||||
class MemoryStorageSettings(StorageSettings):
|
||||
type: Literal[StorageTypeEnum.MEMORY.value] = StorageTypeEnum.MEMORY.value
|
||||
|
||||
|
||||
class RedisStorageSettings(StorageSettings):
|
||||
type: Literal[StorageTypeEnum.REDIS.value] = StorageTypeEnum.REDIS.value
|
||||
host: str = "localhost"
|
||||
port: int = 6379
|
||||
database: int = 0
|
||||
password: str | None = None
|
||||
max_connections: int = 10
|
||||
Reference in New Issue
Block a user