From 2779098b1e6cedb3d486566bc3a5132ec609f8e4 Mon Sep 17 00:00:00 2001 From: geekiot Date: Thu, 30 Oct 2025 18:24:24 +0500 Subject: [PATCH] Add [redis]: add new env-vars for config, update docs --- src/config/utils.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/config/utils.py b/src/config/utils.py index 8f21dea..19813a2 100644 --- a/src/config/utils.py +++ b/src/config/utils.py @@ -28,6 +28,26 @@ class Settings(BaseSettings): The .env file is located in the project root. Env Vars: + postgres_host (str): + PostgreSQL host name. + Defaults to "postgres". + postgres_port (int): + PostgreSQL port. + Defaults to 5432. + postgres_user (str): + PostgreSQL user name. + postgres_pass (str): + PostgreSQL user password. + postgres_name (str): + PostgreSQL database name. + + redis_host (str): + Redis host name. + Defaults to "redis" + redis_port (int): + Redis port. + Defaults to 6379. + bot_token (str): Telegram API bot token. listen_logging (bool): @@ -51,12 +71,16 @@ class Settings(BaseSettings): @property def database_url(self): + """Get PostgreSQL database url.""" return ( f"postgresql+asyncpg://{self.postgres_user}:" f"{self.postgres_pass}@{self.postgres_host}:" f"{self.postgres_port}/{self.postgres_name}" ) + redis_host: str = Field(frozen=True, default="redis") + redis_port: int = Field(frozen=True, default=6379) + bot_token: str = Field(frozen=True) listen_logging: bool = Field(