opendal_storage_config.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from enum import StrEnum
  2. from typing import Literal
  3. from pydantic import Field
  4. from pydantic_settings import BaseSettings
  5. class OpenDALScheme(StrEnum):
  6. FS = "fs"
  7. S3 = "s3"
  8. class OpenDALStorageConfig(BaseSettings):
  9. STORAGE_OPENDAL_SCHEME: str = Field(
  10. default=OpenDALScheme.FS.value,
  11. description="OpenDAL scheme.",
  12. )
  13. # FS
  14. OPENDAL_FS_ROOT: str = Field(
  15. default="storage",
  16. description="Root path for local storage.",
  17. )
  18. # S3
  19. OPENDAL_S3_ROOT: str = Field(
  20. default="/",
  21. description="Root path for S3 storage.",
  22. )
  23. OPENDAL_S3_BUCKET: str = Field(
  24. default="",
  25. description="S3 bucket name.",
  26. )
  27. OPENDAL_S3_ENDPOINT: str = Field(
  28. default="https://s3.amazonaws.com",
  29. description="S3 endpoint URL.",
  30. )
  31. OPENDAL_S3_ACCESS_KEY_ID: str = Field(
  32. default="",
  33. description="S3 access key ID.",
  34. )
  35. OPENDAL_S3_SECRET_ACCESS_KEY: str = Field(
  36. default="",
  37. description="S3 secret access key.",
  38. )
  39. OPENDAL_S3_REGION: str = Field(
  40. default="",
  41. description="S3 region.",
  42. )
  43. OPENDAL_S3_SERVER_SIDE_ENCRYPTION: Literal["aws:kms", ""] = Field(
  44. default="",
  45. description="S3 server-side encryption.",
  46. )