Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/featureRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
run: |
docker create -p 27017:27017 --name FileFighterDB mongo:latest
docker start FileFighterDB
-
name: Run Tests and update Sonar
run: mvn clean test sonar:sonar -s ./settings.xml
-
name: Build Docker Image
run: mvn spring-boot:build-image -f pom.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
package de.filefighter.rest.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

import java.util.ArrayList;
import java.util.Arrays;

@Configuration
public class RestConfiguration {

//Custom static constants
Expand All @@ -21,17 +11,7 @@ public class RestConfiguration {
public static final String USER_BASE_URI = "/users/";
public static final String DEFAULT_ERROR_PATH = "/error";

@Bean
public CorsFilter corsFilter(){
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final CorsConfiguration config = new CorsConfiguration();
// Don't do this in production, use a proper list of allowed origins
ArrayList<String> allowedOrigins = new ArrayList<>();
allowedOrigins.add("http://localhost:3000");
config.setAllowedOrigins(allowedOrigins);
config.setAllowedHeaders(Arrays.asList("Origin", "Content-Type", "Accept"));
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH"));
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
private RestConfiguration(){
// Cannot be inst
}
}
}