Configuration & Environment Variables
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Dashboard Task Management (DTM) system utilizes a Spring Boot backend and a Vue.js frontend, requiring specific configurations for security, database connectivity, and file management. The application follows a traditional Spring Boot architecture where backend settings are managed via property files and Java-based configuration classes, while the frontend interacts with the backend through a defined set of API base URLs and authentication tokens.
Key configuration areas include database connection strings for PostgreSQL, JWT (JSON Web Token) settings for stateless authentication, and local file system paths for storing task attachments. These configurations ensure that the system maintains role-based access control (RBAC) across its various administrative and team-oriented modules.
Sources: README.md:4-7, src/main/java/com/example/demo/config/SecurityConfig.java:27-32
Backend Infrastructure & Dependencies
The project is built using Maven and Java 21. It relies on several Spring Boot starters to manage web services, data persistence, and security.
Core Dependencies
The system utilizes the following primary technologies:
- Java Version: 21
- Framework: Spring Boot 3.2.5
- Database: PostgreSQL (with JPA/Hibernate)
- Security: Spring Security with JJWT (Java JWT)
- Documentation: SpringDoc OpenAPI (Swagger UI)
Sources: pom.xml:18-62, README.md:188-192
Maven Wrapper Configuration
The mvnw.cmd script allows for a consistent build environment by automatically downloading and configuring the required Apache Maven distribution. It uses the .mvn/wrapper/maven-wrapper.properties file to determine the distribution URL and SHA-256 checksum for validation.
Sources: mvnw.cmd:44-55, mvnw.cmd:111-120
Security & Authentication Configuration
The system implements a dual-layered security configuration to handle both RESTful API requests and standard HTML web page navigation.
Security Filter Chains
The SecurityConfig class defines two distinct SecurityFilterChain beans with specific orders:
- API Chain (Order 1): Targets
/api/**. It is stateless, disables CSRF, and requires JWT authentication for all requests except/api/auth/**. - Web Chain (Order 2): Targets all other routes (HTML pages, CSS, JS). It uses form-based login and permits access to static resources and the login/register pages.
The diagram shows how incoming requests are routed to different security filter chains based on the URL pattern.
Sources: src/main/java/com/example/demo/config/SecurityConfig.java:38-73
JWT and Password Management
The application uses BCryptPasswordEncoder for hashing user passwords and integrates JWT for authorization. The JWT token is expected in the Authorization header as a Bearer token for API requests.
Sources: src/main/java/com/example/demo/config/SecurityConfig.java:22-26, src/main/java/com/example/demo/config/SecurityConfig.java:76-78
Database & Persistence Settings
The backend is configured to connect to a PostgreSQL database. Configuration properties typically found in application.properties (as described in the setup guide) include:
| Property | Description | Default/Example Value |
|---|---|---|
spring.datasource.url | JDBC connection string for PostgreSQL | jdbc:postgresql://localhost:5432/taskdb |
spring.datasource.username | Database user | postgres |
spring.datasource.password | Database password | yourpassword |
Sources: README.md:195-197
File System & Attachment Configuration
The AttachmentService manages file uploads and storage. It utilizes an environment-defined upload directory and enforces strict validation on file types and sizes.
Storage Parameters
The system defines the following constraints for file management:
- Upload Directory: Configured via the
${file.upload-dir}property. - Maximum File Size: 10 MB.
- Temporary Storage: Files are initially uploaded to a
tempsubdirectory before being moved to entity-specific folders (e.g.,task/orcomment/).
Sources: src/main/java/com/example/demo/services/AttachmentService.java:38-57, src/main/java/com/example/demo/services/AttachmentService.java:108-115
Allowed MIME Types
| Category | MIME Types |
|---|---|
| Images | image/jpeg, image/png, image/gif, image/webp |
| Documents | application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| Spreadsheets | application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
| Others | text/plain, application/zip, application/x-rar-compressed |
Sources: src/main/java/com/example/demo/services/AttachmentService.java:42-53
Frontend API Configuration
The frontend communicates with the backend via a centralized API module. It uses a base URL and manages the JWT token lifecycle.
API Connection Details
- Base URL:
http://localhost:8080(or/apirelative to the host). - Token Storage: The JWT is stored in
localStorageunder the keydtm_token. - Request Interceptors: Every request automatically attaches the
Authorization: Bearer <token>header if a token exists.
The sequence diagram illustrates the flow of authentication tokens from local storage to API requests and the handling of unauthorized responses.
Sources: src/main/resources/static/js/api.js:6-25, README.md:158-182
Summary
The "Configuration & Environment Variables" within the Dashboard project establish the necessary boundaries for security, data persistence, and file handling. By leveraging Spring Boot's modular configuration and a clear separation between API and Web security filters, the system provides a robust environment for team collaboration and task management. Proper setup of the PostgreSQL database and file upload directories is essential for the application's functional deployment.