91 lines
2.6 KiB
Python
91 lines
2.6 KiB
Python
"""General application settings."""
|
|
|
|
import os
|
|
from pydantic import Field
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings."""
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
|
)
|
|
|
|
# --- General Settings ---
|
|
|
|
# Preprocessing configuration file path.
|
|
PP_CONFIG_PATH: str = Field(
|
|
"src/pp-config.yaml",
|
|
description="Path to the preprocessing configuration YAML file.",
|
|
)
|
|
|
|
# SQLite database file path.
|
|
# For in memory, use ":memory:" (not persistent).
|
|
# Uses DATA_DIR environment variable for Azure persistent storage
|
|
DB_PATH: str = Field(
|
|
default_factory=lambda: os.path.join(
|
|
os.environ.get("DATA_DIR", "data"), "database.sqlite"
|
|
),
|
|
description="Path to the SQLite database.",
|
|
)
|
|
|
|
# --- Database Query Settings ---
|
|
|
|
# Maximum number of rows to return from SQL queries.
|
|
SQL_ROW_LIMIT: int = Field(
|
|
default=50,
|
|
description="Maximum number of rows to return from SQL queries. Defaults to 50.",
|
|
)
|
|
|
|
# --- API Keys ---
|
|
|
|
# Preprocessor API key to access this app.
|
|
PP_API_KEY: str = Field(
|
|
..., description="API key to access this app for preprocessing."
|
|
)
|
|
|
|
# API key needed to access the endpoint that queries the database.
|
|
DB_ENDPOINT_API_KEY: str = Field(
|
|
..., description="API key needed to access the database query endpoint."
|
|
)
|
|
|
|
# --- Power BI Settings ---
|
|
|
|
# Power BI base URL.
|
|
POWERBI_BASE_URL: str = Field(
|
|
"https://api.powerbi.com/v1.0/myorg",
|
|
# "https://api.powerbigov.us/v1.0/myorg", # Rare: US Gov Cloud
|
|
# "https://api.powerbi.de/v1.0/myorg", # Rare: Germany
|
|
# "https://api.powerbi.cn/v1.0/myorg", # Rare: China
|
|
description="Base URL for Power BI REST API.",
|
|
)
|
|
|
|
# Power BI authority base.
|
|
POWERBI_AUTHORITY_BASE: str = Field(
|
|
"https://login.microsoftonline.com",
|
|
description="Base URL for Power BI authority.",
|
|
)
|
|
|
|
# Power BI Dataset ID.
|
|
POWERBI_DATASET_ID: str = Field(
|
|
..., description="Power BI Dataset ID to read data from."
|
|
)
|
|
|
|
# Power BI Tenant ID.
|
|
POWERBI_TENANT_ID: str = Field(
|
|
..., description="Azure AD Tenant ID for Power BI authentication."
|
|
)
|
|
|
|
# Power BI Client ID.
|
|
POWERBI_CLIENT_ID: str = Field(
|
|
..., description="Azure AD Client ID for Power BI authentication."
|
|
)
|
|
|
|
# Power BI Client Secret.
|
|
POWERBI_CLIENT_SECRET: str = Field(
|
|
..., description="Azure AD Client Secret for Power BI authentication."
|
|
)
|
|
|
|
|
|
settings = Settings()
|