config.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import secrets
  2. from typing import Any, Dict, List, Optional, Union
  3. from pydantic import AnyHttpUrl, BaseSettings, EmailStr, HttpUrl, PostgresDsn, validator, DirectoryPath
  4. class Settings(BaseSettings):
  5. API_V1_STR: str = "/api/v1"
  6. SECRET_KEY: str = secrets.token_urlsafe(32)
  7. # 60 minutes * 24 hours * 8 days = 8 days
  8. ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
  9. SERVER_HOST: AnyHttpUrl = "http://cmm.ai:8088"
  10. PROJECT_NAME = 'ntcri'
  11. SMTP_TLS: bool = True
  12. SMTP_PORT: Optional[int] = "587"
  13. SMTP_HOST: Optional[str] = "smtp.gmail.com"
  14. SMTP_USER: Optional[str] = "zooey@choozmo.com"
  15. SMTP_PASSWORD: Optional[str] = "bnufmjzkyezputip"
  16. EMAILS_FROM_EMAIL: Optional[EmailStr] = 'zooey@choozmo.com'
  17. EMAILS_FROM_NAME: Optional[str] = 'zooey'
  18. EMAILS_ENABLED: bool = True
  19. @validator("EMAILS_ENABLED", pre=True, check_fields=False)
  20. def get_emails_enabled(cls, v: bool, values: Dict[str, Any]) -> bool:
  21. return bool(
  22. values.get("SMTP_HOST")
  23. and values.get("SMTP_PORT")
  24. and values.get("EMAILS_FROM_EMAIL")
  25. )
  26. EMAIL_TEMPLATES_DIR: str = "C:\/Users\/s1301\/PycharmProjects\/fastdemo\/app\email-templates"
  27. EMAIL_RESET_TOKEN_EXPIRE_HOURS: int = 48
  28. CLIENT_ID = "626437744072-q6djn202411is5vdk2v0tu8fo7n07qr0.apps.googleusercontent.com"
  29. settings = Settings()