feat: multi app support

This commit is contained in:
hongqiaowei
2021-01-26 18:21:48 +08:00
parent 174011941d
commit 61da1aa81f
2 changed files with 13 additions and 4 deletions

View File

@@ -235,7 +235,11 @@ public class ApiConfigService {
Set<ApiConfig> acs = sc.getApiConfigs(method, path, gatewayGroup);
if (acs != null) {
for (ApiConfig ac : acs) {
if (apiConifg2appsService.contains(ac.id, app)) {
if (ac.checkApp) {
if (apiConifg2appsService.contains(ac.id, app)) {
return ac;
}
} else {
return ac;
}
}

View File

@@ -25,6 +25,7 @@ import org.springframework.util.AntPathMatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod;
import we.util.JacksonUtils;
import we.util.ThreadContext;
import java.util.*;
@@ -125,11 +126,15 @@ public class ServiceConfig {
@JsonIgnore
public Set<ApiConfig> getApiConfigs(HttpMethod method, String path, String gatewayGroup) {
Set<ApiConfig> apiConfigs = null;
GatewayGroup2apiConfig r = getApiConfig(method, path);
if (r == null) {
return null;
if (r != null) {
apiConfigs = r.get(gatewayGroup);
}
return r.get(gatewayGroup);
if (log.isDebugEnabled()) {
log.debug(gatewayGroup + ' ' + method + ' ' + path + ' ' + JacksonUtils.writeValueAsString(apiConfigs));
}
return apiConfigs;
}
private GatewayGroup2apiConfig getApiConfig(HttpMethod method, String reqPath) {