| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- from typing import Optional
-
- from pydantic import Field, NonNegativeInt, PositiveFloat, PositiveInt
- from pydantic_settings import BaseSettings
-
-
- class RedisConfig(BaseSettings):
- """
- Configuration settings for Redis connection
- """
-
- REDIS_HOST: str = Field(
- description="Hostname or IP address of the Redis server",
- default="localhost",
- )
-
- REDIS_PORT: PositiveInt = Field(
- description="Port number on which the Redis server is listening",
- default=6379,
- )
-
- REDIS_USERNAME: Optional[str] = Field(
- description="Username for Redis authentication (if required)",
- default=None,
- )
-
- REDIS_PASSWORD: Optional[str] = Field(
- description="Password for Redis authentication (if required)",
- default=None,
- )
-
- REDIS_DB: NonNegativeInt = Field(
- description="Redis database number to use (0-15)",
- default=0,
- )
-
- REDIS_USE_SSL: bool = Field(
- description="Enable SSL/TLS for the Redis connection",
- default=False,
- )
-
- REDIS_SSL_CERT_REQS: str = Field(
- description="SSL certificate requirements (CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED)",
- default="CERT_NONE",
- )
-
- REDIS_SSL_CA_CERTS: Optional[str] = Field(
- description="Path to the CA certificate file for SSL verification",
- default=None,
- )
-
- REDIS_SSL_CERTFILE: Optional[str] = Field(
- description="Path to the client certificate file for SSL authentication",
- default=None,
- )
-
- REDIS_SSL_KEYFILE: Optional[str] = Field(
- description="Path to the client private key file for SSL authentication",
- default=None,
- )
-
- REDIS_USE_SENTINEL: Optional[bool] = Field(
- description="Enable Redis Sentinel mode for high availability",
- default=False,
- )
-
- REDIS_SENTINELS: Optional[str] = Field(
- description="Comma-separated list of Redis Sentinel nodes (host:port)",
- default=None,
- )
-
- REDIS_SENTINEL_SERVICE_NAME: Optional[str] = Field(
- description="Name of the Redis Sentinel service to monitor",
- default=None,
- )
-
- REDIS_SENTINEL_USERNAME: Optional[str] = Field(
- description="Username for Redis Sentinel authentication (if required)",
- default=None,
- )
-
- REDIS_SENTINEL_PASSWORD: Optional[str] = Field(
- description="Password for Redis Sentinel authentication (if required)",
- default=None,
- )
-
- REDIS_SENTINEL_SOCKET_TIMEOUT: Optional[PositiveFloat] = Field(
- description="Socket timeout in seconds for Redis Sentinel connections",
- default=0.1,
- )
-
- REDIS_USE_CLUSTERS: bool = Field(
- description="Enable Redis Clusters mode for high availability",
- default=False,
- )
-
- REDIS_CLUSTERS: Optional[str] = Field(
- description="Comma-separated list of Redis Clusters nodes (host:port)",
- default=None,
- )
-
- REDIS_CLUSTERS_PASSWORD: Optional[str] = Field(
- description="Password for Redis Clusters authentication (if required)",
- default=None,
- )
-
- REDIS_SERIALIZATION_PROTOCOL: int = Field(
- description="Redis serialization protocol (RESP) version",
- default=3,
- )
-
- REDIS_ENABLE_CLIENT_SIDE_CACHE: bool = Field(
- description="Enable client side cache in redis",
- default=False,
- )
|