Skip to content

Commit

Permalink
feat: 加上listCvmIpFromProject #2842
Browse files Browse the repository at this point in the history
  • Loading branch information
zzdjx committed Dec 20, 2024
1 parent 2975f9e commit 5e3a42a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ open class DevXAccessInterceptor(private val devXProperties: DevXProperties) : H
val projectIdList = devXProperties.projectWhiteList[projectId] ?: emptySet()
val ips = HashSet<String>()
projectIdList.forEach {
val projectIps = listIpFromProject(it)
ips.addAll(projectIps)
ips.addAll(listIpFromProject(it))
ips.addAll(listCvmIpFromProject(it))
}
return ips
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ data class DevXProperties(
var projectCvmWhiteList: Map<String, Set<String>> = emptyMap(),
/**
* 配置可以被访问的项目
* key 为项目ip, value为可被访问的项目ip
* key 为项目id, value为可被访问的项目id
*/
var projectWhiteList: Map<String, Set<String>> = emptyMap(),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ class DevxWorkspaceUtils(
private fun listIpFromProjects(projectId: String): Mono<Set<String>> {
val projectIdList = devXProperties.projectWhiteList[projectId] ?: emptySet()
return Flux.fromIterable(projectIdList)
.flatMap { pid -> listIpFromProject(pid) }
.flatMap { id ->
Flux.merge(
listIpFromProject(id),
listCvmIpFromProject(id)
)
}
.flatMapIterable { it }
.collect(Collectors.toSet())
}
Expand Down

0 comments on commit 5e3a42a

Please sign in to comment.