Skip to content

Commit

Permalink
Also check map keys when determining if CORS configuration is present
Browse files Browse the repository at this point in the history
  • Loading branch information
urbim committed Dec 1, 2022
1 parent 10bbe42 commit 0ac6900
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/com/kumuluz/ee/cors/CorsExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.logging.Logger;
Expand All @@ -63,7 +64,11 @@ public void init(KumuluzServerWrapper kumuluzServerWrapper, EeConfig eeConfig) {

ConfigurationUtil cfg = ConfigurationUtil.getInstance();

boolean corsEnabled = cfg.getBoolean("kumuluzee.cors-filter.servlet.enabled").orElse(true);
boolean corsEnabled = cfg.getBoolean("kumuluzee.cors-filter.servlet.enabled").orElseGet(() -> {
Optional<List<String>> mapKeys = cfg.getMapKeys("kumuluzee.cors-filter.servlet");

return mapKeys.isPresent() && !mapKeys.get().isEmpty();
});

CorsConfig corsConfig = null;

Expand Down

0 comments on commit 0ac6900

Please sign in to comment.