config.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 backend API url.
  14. api_url: str = constants.API_URL
  15. # The database url.
  16. db_url: Optional[str] = constants.DB_URL
  17. # The redis url.
  18. redis_url: Optional[str] = None
  19. # Telemetry opt-in.
  20. telemetry_enabled: bool = True
  21. # The deploy url.
  22. deploy_url: Optional[str] = None
  23. # The environment mode.
  24. env: constants.Env = constants.Env.DEV
  25. # The path to the bun executable.
  26. bun_path: str = constants.BUN_PATH
  27. # Additional frontend packages to install.
  28. frontend_packages: List[str] = []
  29. # Backend transport methods.
  30. backend_transports: Optional[
  31. constants.Transports
  32. ] = constants.Transports.WEBSOCKET_POLLING
  33. # List of origins that are allowed to connect to the backend API.
  34. cors_allowed_origins: Optional[list] = [constants.CORS_ALLOWED_ORIGINS]
  35. # Whether credentials (cookies, authentication) are allowed in requests to the backend API.
  36. cors_credentials: Optional[bool] = True
  37. # The maximum size of a message when using the polling backend transport.
  38. polling_max_http_buffer_size: Optional[int] = constants.POLLING_MAX_HTTP_BUFFER_SIZE