Coverage for backend / app / config.py: 96%

56 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-17 21:34 +0000

1"""JAM configuration""" 

2 

3from importlib.metadata import version, PackageNotFoundError 

4from pathlib import Path 

5 

6from pydantic_settings import BaseSettings, SettingsConfigDict 

7 

8 

9def get_app_version() -> str: 

10 """Get the current version of the app""" 

11 

12 try: 

13 return version("jam") 

14 except PackageNotFoundError: 

15 return "0.0.0" 

16 

17 

18class Settings(BaseSettings): 

19 # Database settings 

20 database_hostname: str 

21 database_port: str 

22 database_password: str 

23 database_name: str 

24 database_username: str 

25 

26 # JWT settings 

27 secret_key: str 

28 algorithm: str 

29 access_token_expire_minutes: int 

30 

31 # Application settings 

32 app_version: str = get_app_version() 

33 max_file_size_mb: int 

34 min_password_length: int 

35 monthly_scrape_quota: int 

36 scrape_retry_delay_hours: float 

37 scrape_max_retry: int 

38 min_scraping_description_length: int 

39 max_scraping_description_length: int 

40 max_scraping_title_length: int 

41 max_scraping_company_length: int 

42 

43 # Other settings 

44 log_directory: str 

45 test_mode: bool 

46 

47 # Email configuration 

48 main_email_username: str 

49 main_email_password: str 

50 scraper_email_username: str 

51 scraper_email_password: str 

52 email_smtp_port: int 

53 email_smtp_host: str 

54 email_imap_port: int 

55 email_imap_host: str 

56 info_email: str 

57 support_email: str 

58 

59 # URL configuration 

60 frontend_url: str 

61 backend_url: str 

62 

63 # Verification settings 

64 verification_token_expiration_minutes: int 

65 password_reset_token_expiration_minutes: int 

66 email_change_token_expiration_minutes: int 

67 verification_email_min_interval_seconds: int 

68 

69 # BrightData 

70 brightdata_api_key: str 

71 brightdata_linkedin_dataset_id: str 

72 brightdata_indeed_dataset_id: str 

73 

74 # OpenAI 

75 openai_api_key: str 

76 

77 # Anthropic 

78 anthropic_api_key: str 

79 

80 # Apify 

81 apify_api_key: str 

82 

83 # Stripe 

84 stripe_api_key: str 

85 stripe_webhook_secret: str 

86 stripe_toast_price_id: str 

87 

88 model_config = SettingsConfigDict( 

89 env_file=Path(__file__).parent.parent / ".env", 

90 ) 

91 

92 

93settings = Settings() # type: ignore[call-arg]