Merge pull request #414 from wehotel/develop

This commit is contained in:
hongqiaowei
2022-03-29 18:46:49 +08:00
committed by GitHub
11 changed files with 43 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ English | [简体中文](./README.md)
<a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a>
</p>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-2.5.2-blue.svg?cacheSeconds=2592000" />
<img alt="Version" src="https://img.shields.io/badge/version-2.6.0-blue.svg?cacheSeconds=2592000" />
<a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
@@ -120,6 +120,7 @@ Starting from v1.3.0, the frontend and backend of the management backend are mer
| v2.5.0 | v2.5.0 |
| v2.5.1 | v2.5.1 |
| v2.5.2 | v2.5.2 |
| v2.6.0 | v2.6.0 |
Please download the corresponding management backend version according to the version of the community version

View File

@@ -3,7 +3,7 @@
<a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a>
</p>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-2.5.2-blue.svg?cacheSeconds=2592000" />
<img alt="Version" src="https://img.shields.io/badge/version-2.6.0-blue.svg?cacheSeconds=2592000" />
<a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
@@ -118,6 +118,7 @@ API地址http://demo.fizzgate.com/proxy/[服务名]/[API_Path]
| v2.5.0 | v2.5.0 |
| v2.5.1 | v2.5.1 |
| v2.5.2 | v2.5.2 |
| v2.6.0 | v2.6.0 |
请根据社区版的版本下载对应的管理后台版本

View File

@@ -12,7 +12,7 @@
<groupId>com.fizzgate</groupId>
<artifactId>fizz-bootstrap</artifactId>
<version>2.6</version>
<version>2.6.0</version>
<properties>
<java.version>1.8</java.version>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId>
<version>2.6</version>
<version>2.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId>
<version>2.6</version>
<version>2.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -20,11 +20,13 @@ package we.service_registry.nacos;
import com.alibaba.cloud.nacos.NacosServiceManager;
import com.alibaba.cloud.nacos.registry.NacosRegistration;
import com.alibaba.cloud.nacos.registry.NacosServiceRegistry;
import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.naming.NamingService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import we.util.Consts;
import we.util.JacksonUtils;
import we.util.PropertiesUtils;
import we.util.ReflectionUtils;
@@ -45,14 +47,21 @@ public abstract class FizzNacosHelper {
Properties ps = new Properties();
for (String propertyName : nacosProperties.stringPropertyNames()) {
String pn = propertyName.substring(ndl);
if (pn.indexOf(Consts.S.DASH) > -1) {
pn = PropertiesUtils.normalize(pn);
String propertyValue = nacosProperties.getProperty(propertyName);
if (propertyName.endsWith(PropertyKeyConst.USERNAME)) {
ps.setProperty(PropertyKeyConst.USERNAME, propertyValue);
} else if (propertyName.endsWith(PropertyKeyConst.PASSWORD)) {
ps.setProperty(PropertyKeyConst.PASSWORD, propertyValue);
} else {
String pn = propertyName.substring(ndl);
if (pn.indexOf(Consts.S.DASH) > -1) {
pn = PropertiesUtils.normalize(pn);
}
ps.setProperty(pn, propertyValue);
}
ps.setProperty(pn, nacosProperties.getProperty(propertyName));
}
FizzNacosProperties fizzNacosProperties = new FizzNacosProperties();
FizzNacosProperties fizzNacosProperties = new FizzNacosProperties(ps);
PropertiesUtils.setBeanPropertyValue(fizzNacosProperties, ps);
fizzNacosProperties.setApplicationContext(applicationContext);
@@ -84,7 +93,8 @@ public abstract class FizzNacosHelper {
NacosServiceManager nacosServiceManager = new NacosServiceManager();
ReflectionUtils.set(nacosServiceRegistry, "nacosServiceManager", nacosServiceManager);
NacosRegistration nacosRegistration = new NacosRegistration(null, fizzNacosProperties, applicationContext);
NamingService namingService = nacosServiceManager.getNamingService(fizzNacosProperties.getNacosProperties());
Properties nps = fizzNacosProperties.getNacosProperties();
NamingService namingService = nacosServiceManager.getNamingService(nps);
return new FizzNacosServiceRegistration(fizzNacosProperties.getId(), nacosRegistration, nacosServiceRegistry, namingService);
}
}

View File

@@ -99,6 +99,12 @@ public class FizzNacosProperties extends NacosDiscoveryProperties {
private boolean init = false;
private Properties config;
public FizzNacosProperties(Properties config) {
this.config = config;
}
public void init() {
if (init) {
return;
@@ -452,9 +458,17 @@ public class FizzNacosProperties extends NacosDiscoveryProperties {
properties.put(NAMING_LOAD_CACHE_AT_START, namingLoadCacheAtStart);
properties.put("enabled", true);
properties.put("server-addr", this.getServerAddr());
// properties.put("server-addr", serverAddr);
properties.put("com.alibaba.nacos.naming.log.filename", "");
config.forEach(
(c, v) -> {
if (!properties.containsKey(c)) {
properties.put(c, v);
}
}
);
return properties;
}
}

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId>
<version>2.6</version>
<version>2.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId>
<version>2.6</version>
<version>2.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -8,6 +8,7 @@ we.config.ProxyWebClientConfig,\
we.config.RefreshLocalCacheConfig,\
we.config.SystemConfig,\
we.config.WebServerConfig,\
we.config.FizzGatewayNodeStatSchedConfig,\
we.controller.HealthCheckController,\
we.controller.CacheCheckController,\
we.controller.CallbackController,\

View File

@@ -37,7 +37,7 @@
<artifactId>fizz-gateway-community</artifactId>
<name>${project.artifactId}</name>
<description>fizz gateway community</description>
<version>2.6</version>
<version>2.6.0</version>
<packaging>pom</packaging>
<modules>
<module>fizz-common</module>
@@ -150,7 +150,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.79</version>
<version>1.2.80</version>
</dependency>
<dependency>