# Feature Specification: Add web application settings mechanism **Feature Branch**: `002-app-settings` **Created**: 2025-12-20 **Status**: Draft **Input**: User description: "давай внесем полноценный механизм настройки веб приложения. Что нужно точно - 1. Интерфейс для добавления enviroments (разные сервера суперсета) 2. Интерфейс для настройки файлового хранилища бекапов" ## User Scenarios & Testing *(mandatory)* ### User Story 1 - Manage Superset Environments (Priority: P1) As an administrator, I want to add, edit, and remove Superset environment configurations (URL, credentials, name) so that the application can interact with multiple Superset instances. **Why this priority**: This is the core functionality required for the tool to be useful across different stages (dev/prod) or different Superset clusters. **Independent Test**: Can be fully tested by adding a new environment, verifying it appears in the list, and then deleting it. **Acceptance Scenarios**: 1. **Given** the settings page is open, **When** I enter valid Superset connection details and save, **Then** the new environment is added to the list of available targets. 2. **Given** an existing environment, **When** I update its URL and save, **Then** the system uses the new URL for subsequent operations. 3. **Given** an existing environment, **When** I delete it, **Then** it is no longer available for selection in other parts of the application. --- ### User Story 2 - Configure Backup Storage (Priority: P1) As an administrator, I want to configure the file path or storage location for backups so that I can control where system backups are stored. **Why this priority**: Essential for the backup plugin to function correctly and for users to manage disk space/storage locations. **Independent Test**: Can be tested by setting a backup path and verifying that the system validates the path's existence or accessibility. **Acceptance Scenarios**: 1. **Given** the storage settings section, **When** I provide a valid local or network path, **Then** the system saves this as the default backup location. 2. **Given** an invalid or inaccessible path, **When** I try to save, **Then** the system displays an error message and does not update the setting. --- ### Edge Cases - **Duplicate Environments**: What happens when a user tries to add an environment with a name that already exists? (System should prevent duplicates). - **Invalid Credentials**: How does the system handle saving environments with incorrect credentials? (System should ideally validate connection on save). - **Path Permissions**: How does the system handle a backup path that is valid but the application lacks write permissions for? (System should check write permissions). ## Requirements *(mandatory)* ### Functional Requirements - **FR-001**: System MUST provide a dedicated settings interface in the web UI. - **FR-002**: System MUST allow users to create multiple named "Environments" for Superset. - **FR-003**: Each Environment MUST include: Name, Base URL, and Authentication details (e.g., Username/Password or API Key). - **FR-004**: System MUST allow setting a global "Backup Storage Path". - **FR-005**: System MUST persist these settings across application restarts. - **FR-006**: System MUST validate the Superset URL format before saving. - **FR-007**: System MUST verify that the Backup Storage Path is writable by the application. - **FR-008**: System MUST allow selecting a "Default" environment for operations. ### System Invariants (Constitution Check) - **INV-001**: Sensitive credentials (passwords/keys) MUST NOT be displayed in plain text after being saved. - **INV-002**: At least one environment MUST be configured for the application to perform Superset-related tasks. ### Key Entities *(include if feature involves data)* - **Environment**: Represents a Superset instance. Attributes: Unique ID, Name, URL, Credentials, IsDefault flag. - **AppConfiguration**: Singleton entity representing global settings. Attributes: BackupPath, DefaultEnvironmentID. ## Success Criteria *(mandatory)* ### Measurable Outcomes - **SC-001**: Users can add a new Superset environment in under 30 seconds. - **SC-002**: 100% of saved environments are immediately available for use in backup/migration tasks. - **SC-003**: System prevents saving invalid backup paths 100% of the time. - **SC-004**: Configuration changes take effect without requiring a manual restart of the backend services.