Skip to content

Commit

Permalink
Allow Spring configRoot to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
FloBoJa committed Dec 13, 2023
1 parent cdf816b commit 25b5012
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@ class SpringRules implements Rule {

var applicationName = SpringHelper.getFromYamlOrProperties("spring.application.name", bootstrapYaml,
applicationProperties)
val projectConfigYaml = yamlMappers.get(
SpringHelper.findFile(yamlMappers.keySet, configRoot.resolve("src/main/resources/shared"),
Set.of(applicationName + ".yaml", applicationName + ".yml")))
if (applicationName === null) {
applicationName = "UNKNOWN-spring-application"
}

val projectConfigYaml = configRoot === null
? null
: yamlMappers.get(
SpringHelper.findFile(yamlMappers.keySet, configRoot.resolve("src/main/resources/shared"),
Set.of(applicationName + ".yaml", applicationName + ".yml")))
val contextPathOption = Optional.ofNullable(projectConfigYaml).flatMap[x|x.apply("server.servlet.context-path")]
var contextPath = contextPathOption.orElse("/")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class SpringZuulRules implements Rule {

val projectRoot = SpringHelper.findProjectRoot(path, poms)
val configRoot = SpringHelper.findConfigRoot(poms)

if (configRoot === null) {
return
}

var routeMap = blackboard.getPartition(RULE_ID) as Map<Path, List<GatewayRoute>>
if (routeMap === null) {
Expand Down

0 comments on commit 25b5012

Please sign in to comment.