Configuration Management Guide
This guide describes how configuration settings are managed in Waldur Homeport, including the architecture, design patterns, and the integration with Waldur Mastermind.
Architecture Overview
Waldur follows a "Single Source of Truth" pattern for configuration. Settings are defined in the Mastermind backend and exposed to Homeport through auto-generated files and API endpoints.
Backend (Mastermind)
- Constance: Settings are managed using
django-constance. - Definitions: Located in
src/waldur_core/server/constance_settings.py. - Public Exposure: Settings listed in
PUBLIC_CONSTANCE_SETTINGSare available via the/api/override-settings/endpoint.
Frontend (Homeport)
- Meta-data:
src/SettingsDescription.ts(auto-generated) contains descriptions, types, and defaults for settings. - Enums:
src/FeaturesEnums.ts(auto-generated) contains feature flag enums. - API Client: Uses
overrideSettingsRetrievefromwaldur-js-client.
Design Patterns
Configuration Components
Waldur Homeport provides specialized components for building configuration interfaces:
- SettingsCard: Displays a group of settings defined in
SettingsDescription.ts. - SettingsWithTabs: Organized interface with searchable tabs for multiple setting groups.
- FieldRow: Individual setting row with automatic field type detection.
Available Field Types
The SettingsDescription.ts (and thus FieldRow) supports several types:
string: Standard text input.integer: Number input.boolean: Checkbox toggle.choice_field: Dropdown selection (requiresoptions).multiple_choice_field: Multi-select checkboxes or badges.url_field: URL validated text input.color_field: Color picker.image_field: File upload for images.json_list_field: Specialized list editor for JSON data.multilingual_image_field: Map of language codes to images.
Auto-generation Workflow
To keep Homeport in sync with Mastermind's settings definitions, use the following commands in the waldur-mastermind directory:
1 2 3 4 5 | |
How-to: Adding a New Configuration Section
1. Backend Definition (Mastermind)
In waldur_core/server/constance_settings.py:
- Add settings to
CONSTANCE_CONFIG. - Group them in
CONSTANCE_CONFIG_FIELDSETS. - Add keys to
PUBLIC_CONSTANCE_SETTINGS.
2. Frontend Sync
Run the auto-generation commands mentioned above.
3. Frontend Implementation (Homeport)
- Create Component: Create a new component (e.g.,
src/administration/myservice/MyServiceSettings.tsx).
1 2 3 4 5 6 7 8 | |
- Register Route: Add the route in
src/administration/routes.tsunder the appropriate parent (usuallyadmin-configuration).
LLM Quick-start Patterns
When asking an LLM to add configuration:
- Provide backend keys: "I added
ENABLED_REPORTING_SCREENSto Mastermind." - Specify group name: "The settings are in the 'Reporting' group."
- Reference template: "Use
AdministrationSshKeys.tsxas a template." - Target file: "Register the route in
src/administration/routes.ts."