Skip to content

Enhance API with vehicle management and security features - #44

Merged
iSiRaH merged 9 commits into
isirafrom
main
Mar 14, 2026
Merged

Enhance API with vehicle management and security features#44
iSiRaH merged 9 commits into
isirafrom
main

Conversation

@iSiRaH

@iSiRaH iSiRaH commented Mar 14, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 14, 2026 17:43
@iSiRaH
iSiRaH merged commit 4c45e01 into isira Mar 14, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @Value injections 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants