Design
Architecture Overview
The app keeps a reusable Django package layout with a configuration registry, manufacturer plugin registry, and optional multitenancy module. Core services resolve settings through a scope-aware registry and use tenant-aware query helpers to keep data isolation consistent.
Components
- Configuration access:
micboard/services/settings/settings_service.pyfor feature flags, host configuration, app defaults, and scoped settings. - Manufacturer plugin resolution:
micboard/services/common/base/plugin.py. - Tenant scoping: tenant-aware QuerySet/Manager helpers and middleware that attaches request context.
- Admin overrides view: admin-facing UI showing differences between scoped settings and global defaults.
Data Flow
- Request arrives with tenant context resolved via middleware.
- Services query models using tenant-aware helpers (organization/site/campus).
- Manufacturer-specific operations resolve plugins and scoped settings through their canonical services.
- Each configuration definition selects one exact scope; missing values use the documented non-database fallback order.
- Admin settings diff view computes global value + scoped overrides for display.
Settings Resolution Order
- Host setting for immutable
MICBOARD_*deployment controls. - Stored value at the definition’s exact declared scope.
- Host
MICBOARD_CONFIGvalue. - Package default.
SettingDefinitiondefault.- Caller-provided default.
Error Handling
- Missing required setting raises a typed error (
SettingNotFoundError). - Missing manufacturer plugin logs a warning and returns
Nonefor plugin lookup. - Admin settings diff view must handle missing global values safely.
Security and Multi-tenant Considerations
- Tenant isolation uses middleware + QuerySet helpers.
- Do not expose or log sensitive values in admin diff view.
Testing Strategy (planned)
- Unit tests for settings resolution order and required behavior.
- Tests for tenant-scoped query helpers used by services.
- Tests for admin settings diff view rendering and access controls.
Upcoming Resources
- Hummingbird Project - Core design inspiration for scalable, observable Django applications
