dzen.nstarikov.ru/app/config.py

46 lines
1.2 KiB
Python
Raw Normal View History

2026-06-27 14:07:10 +03:00
from functools import lru_cache
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
app_env: str = "production"
app_base_url: str = "https://vk2ok.bot.nstarikov.ru"
sqlite_path: str = "/app/data/vk2ok.sqlite3"
storage_dir: str = "/app/storage"
redis_url: str = "redis://redis:6379/0"
celery_broker_url: str = "redis://redis:6379/0"
celery_result_backend: str = "redis://redis:6379/1"
vk_group_id: str = "9828339"
vk_confirmation_code: str = "58578d71"
vk_secret: str = "590c3c72"
vk_api_version: str = "5.199"
ok_app_id: str = ""
ok_public_key: str = ""
ok_secret_key: str = ""
ok_access_token: str = ""
ok_session_secret_key: str = ""
ok_group_id: str = ""
ytdlp_cookies_path: str = "/app/data/vk_cookies.txt"
@property
def sqlite_url(self) -> str:
return f"sqlite:///{self.sqlite_path}"
@property
def storage_path(self) -> Path:
return Path(self.storage_dir)
@lru_cache
def get_settings() -> Settings:
return Settings()