Files
2026-07-17 09:53:02 +08:00

38 lines
1.2 KiB
Python

import os
from dataclasses import dataclass
@dataclass(frozen=True)
class CubeReportSettings:
dify_api_base: str
dify_api_key: str
cube_api_base: str
cube_api_token: str
request_timeout_seconds: float
default_page_size: int
max_page_size: int
metadata_refresh_seconds: int
def get_cube_report_settings() -> CubeReportSettings:
return CubeReportSettings(
dify_api_base=os.getenv(
"DIFY_DATABASE_ASSISTANT_API_BASE", "https://chat.bbitcn.net/v1"
).rstrip("/"),
dify_api_key=os.getenv(
"DIFY_DATABASE_ASSISTANT_API_KEY", "app-Ojd3zT2wBsO2Bop575ZiHQOD"
),
cube_api_base=os.getenv(
"CUBE_API_BASE_URL", "http://10.10.12.101:4001/cubejs-api/v1"
).rstrip("/"),
cube_api_token=os.getenv("CUBE_API_TOKEN", ""),
request_timeout_seconds=float(
os.getenv("CUBE_REPORT_REQUEST_TIMEOUT_SECONDS", "180")
),
default_page_size=int(os.getenv("CUBE_REPORT_DEFAULT_PAGE_SIZE", "20")),
max_page_size=int(os.getenv("CUBE_REPORT_MAX_PAGE_SIZE", "100")),
metadata_refresh_seconds=int(
os.getenv("CUBE_REPORT_METADATA_REFRESH_SECONDS", "3600")
),
)