23 lines
541 B
Python
23 lines
541 B
Python
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
|