generated from geekiot/python-template
Add [redis]: add new env-vars for config, update docs
This commit is contained in:
parent
79c435031b
commit
2779098b1e
1 changed files with 24 additions and 0 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue