chore: establish project baseline
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Environment-backed Fiscal Hub configuration."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
import os
|
||||
from urllib.parse import quote
|
||||
|
||||
|
||||
def _database_url() -> str:
|
||||
configured = os.getenv("DATABASE_URL")
|
||||
if configured:
|
||||
return configured
|
||||
password = quote(os.getenv("POSTGRES_PASSWORD", "gti"), safe="")
|
||||
return f"postgresql+psycopg://gti:{password}@postgres:5432/gti_fiscal"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Settings:
|
||||
database_url: str = _database_url()
|
||||
hub_port: int = int(os.getenv("HUB_PORT", "8000"))
|
||||
# AGENT_DEV_TOKEN auto-bootstraps an agent from a fixed dev token on every request.
|
||||
# Leave unset in any environment other than local development — production Agents
|
||||
# must be created via scripts/register_agent.py, whose token is never derived from
|
||||
# this setting.
|
||||
agent_dev_token: str = os.getenv("AGENT_DEV_TOKEN", "")
|
||||
environment: str = os.getenv("APP_ENV", "development")
|
||||
log_level: str = os.getenv("LOG_LEVEL", "INFO")
|
||||
base_url: str = os.getenv("BASE_URL", "http://localhost:8000")
|
||||
# An Agent is considered ONLINE if a heartbeat arrived within this many seconds.
|
||||
agent_online_threshold_seconds: int = int(os.getenv("AGENT_ONLINE_THRESHOLD_SECONDS", "120"))
|
||||
ncm_dataset_url: str = os.getenv("NCM_DATASET_URL", "https://portalunico.siscomex.gov.br/classif/api/publico/nomenclatura/download/json")
|
||||
cest_dataset_url: str = os.getenv("CEST_DATASET_URL", "https://www.confaz.fazenda.gov.br/legislacao/convenios/2018/CV142_18")
|
||||
dataset_storage_path: str = os.getenv("DATASET_STORAGE_PATH", "./data/datasets")
|
||||
http_timeout_seconds: float = float(os.getenv("HTTP_TIMEOUT_SECONDS", "30"))
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user