Conversation
…thorization, and CORS, and introduce a new vehicle management API.
… Boot backend application.
… check start period
Deploy Workflow
Add API endpoints for weapon issuance and requests
There was a problem hiding this comment.
Pull request overview
This PR tightens runtime configuration for external ML microservices, introduces a user lookup endpoint for field officers, and adds containerization + AWS ECS deployment artifacts alongside CORS/security-related adjustments.
Changes:
- Make Python microservice base URLs required (no local defaults) and align service
@Valueinjections accordingly. - Centralize CORS handling (removing controller-level
@CrossOrigin) and add configurable allowed-origins support. - Add deployment assets (Dockerfile, ECS task definition template, GitHub Actions deploy workflow) and update environment templates.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/application.properties | Require ML service URLs; add cors.allowed-origins and a pgjdbc/Hikari tuning property. |
| src/main/java/com/crimeLink/analyzer/service/FacialRecognitionService.java | Remove default facial-recognition URL fallback so config must be provided. |
| src/main/java/com/crimeLink/analyzer/service/CallAnalysisService.java | Remove default call-analysis URL fallback so config must be provided. |
| src/main/java/com/crimeLink/analyzer/controller/VehicleController.java | Remove hardcoded @CrossOrigin to rely on global CORS config. |
| src/main/java/com/crimeLink/analyzer/controller/UserController.java | Add /api/users/field-officers endpoint. |
| src/main/java/com/crimeLink/analyzer/config/SecurityConfig.java | Add configurable CORS origins logic in the Security CORS configuration source. |
| backend_logs.txt | Adds backend logs to repo (includes sensitive auth header data). |
| aws/ecs-task-def.json | Introduce an ECS task definition template for Fargate deployment. |
| Dockerfile | Add multi-stage Docker build for the Spring Boot service (JDK 21 → JRE 21). |
| .github/workflows/deploy.yml | Add GitHub Actions workflow to build/push to ECR and trigger ECS deployment. |
| .env.example | Expand/clarify required environment variables, including ML URLs and CORS config. |
| .dockerignore | Add Docker build context exclusions (e.g., target/, .git, backups). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
22
| @GetMapping("/field-officers") | ||
| public List<User> getFieldOfficers() { | ||
| return service.getFieldOfficers(); | ||
| } |
Comment on lines
+54
to
+59
| - name: Force new ECS deployment | ||
| run: | | ||
| aws ecs update-service \ | ||
| --cluster ${{ secrets.ECS_CLUSTER_NAME }} \ | ||
| --service ${{ secrets.ECS_SERVICE_NAME }} \ | ||
| --force-new-deployment |
Comment on lines
130
to
+134
| @Bean | ||
| public CorsConfigurationSource corsConfigurationSource() { | ||
| CorsConfiguration configuration = new CorsConfiguration(); | ||
| // Use allowedOriginPatterns for wildcard support with credentials | ||
| // For production, replace with specific origins | ||
| configuration.setAllowedOriginPatterns(List.of("*")); | ||
| // Or use specific origins (recommended for production): | ||
| // configuration.setAllowedOrigins(Arrays.asList( | ||
| // "http://localhost:5173", | ||
| // "http://localhost:3000", | ||
| // "https://yourdomain.com" | ||
| // )); | ||
| // Use env var CORS_ALLOWED_ORIGINS to configure origins | ||
| // Default: * (all origins) — restrict for production |
Comment on lines
+135
to
+141
| if ("*".equals(corsAllowedOrigins)) { | ||
| configuration.setAllowedOriginPatterns(List.of("*")); | ||
| } else { | ||
| configuration.setAllowedOrigins( | ||
| Arrays.asList(corsAllowedOrigins.split(",")) | ||
| ); | ||
| } |
| backup.directory=${BACKUP_DIR:./backups} | ||
|
|
||
| # CORS Configuration | ||
| cors.allowed-origins=${CORS_ALLOWED_ORIGINS:*} |
|
|
||
| # CORS Configuration | ||
| cors.allowed-origins=${CORS_ALLOWED_ORIGINS:*} | ||
| spring.datasource.hikari.data-source-properties.prepareThreshold=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.