config.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. """The Pynecone config."""
  2. from typing import List, Optional
  3. from pynecone import constants
  4. from pynecone.base import Base
  5. class Config(Base):
  6. """A Pynecone config."""
  7. # The name of the app.
  8. app_name: str
  9. # The username.
  10. username: Optional[str] = None
  11. # The frontend port.
  12. port: str = constants.FRONTEND_PORT
  13. # The frontend port.
  14. backend_port: str = constants.BACKEND_PORT
  15. # The backend API url.
  16. api_url: str = constants.API_URL
  17. # The deploy url.
  18. deploy_url: Optional[str] = None
  19. # The database url.
  20. db_url: Optional[str] = constants.DB_URL
  21. # The redis url.
  22. redis_url: Optional[str] = None
  23. # Telemetry opt-in.
  24. telemetry_enabled: bool = True
  25. # The pcdeploy url.
  26. pcdeploy_url: Optional[str] = None
  27. # The environment mode.
  28. env: constants.Env = constants.Env.DEV
  29. # The path to the bun executable.
  30. bun_path: str = constants.BUN_PATH
  31. # Additional frontend packages to install.
  32. frontend_packages: List[str] = []
  33. # Backend transport methods.
  34. backend_transports: Optional[
  35. constants.Transports
  36. ] = constants.Transports.WEBSOCKET_POLLING
  37. # List of origins that are allowed to connect to the backend API.
  38. cors_allowed_origins: Optional[list] = [constants.CORS_ALLOWED_ORIGINS]
  39. # Whether credentials (cookies, authentication) are allowed in requests to the backend API.
  40. cors_credentials: Optional[bool] = True
  41. # The maximum size of a message when using the polling backend transport.
  42. polling_max_http_buffer_size: Optional[int] = constants.POLLING_MAX_HTTP_BUFFER_SIZE