config.py 1.4 KB

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