config.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 = "https://cmm.ai:8088"
  10. PROJECT_NAME = 'ntcri'
  11. SMTP_TLS: bool = True
  12. #SMTP_SSL: bool = True
  13. SMTP_PORT: Optional[int] = "587"
  14. SMTP_HOST: Optional[str] = "smtp.gmail.com"
  15. SMTP_USER: Optional[str] = "zooey@choozmo.com"
  16. SMTP_PASSWORD: Optional[str] = "bnufmjzkyezputip"
  17. EMAILS_FROM_EMAIL: Optional[EmailStr] = 'zooey@choozmo.com'
  18. EMAILS_FROM_NAME: Optional[str] = 'zooey'
  19. EMAILS_ENABLED: bool = True
  20. @validator("EMAILS_ENABLED", pre=True, check_fields=False)
  21. def get_emails_enabled(cls, v: bool, values: Dict[str, Any]) -> bool:
  22. return bool(
  23. values.get("SMTP_HOST")
  24. and values.get("SMTP_PORT")
  25. and values.get("EMAILS_FROM_EMAIL")
  26. )
  27. #EMAIL_TEMPLATES_DIR: str = "C:\/Users\/s1301\/PycharmProjects\/fastdemo\/app\email-templates"
  28. EMAIL_RESET_TOKEN_EXPIRE_HOURS: int = 48
  29. CLIENT_ID = "626437744072-q6djn202411is5vdk2v0tu8fo7n07qr0.apps.googleusercontent.com"
  30. settings = Settings()