mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sentinel commercialization feature
This commit is contained in:
@@ -31,4 +31,6 @@ public interface SentinelDataSourceConstants {
|
||||
|
||||
String NACOS_DATASOURCE_ENDPOINT = PROPERTY_PREFIX + ".nacos.config.endpoint";
|
||||
|
||||
String PROJECT_NAME = PROPERTY_PREFIX + ".nacos.config.project-name";
|
||||
|
||||
}
|
||||
|
@@ -28,6 +28,25 @@ public class DataSourcePropertiesConfiguration {
|
||||
|
||||
private ApolloDataSourceProperties apollo;
|
||||
|
||||
public DataSourcePropertiesConfiguration() {
|
||||
}
|
||||
|
||||
public DataSourcePropertiesConfiguration(FileDataSourceProperties file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public DataSourcePropertiesConfiguration(NacosDataSourceProperties nacos) {
|
||||
this.nacos = nacos;
|
||||
}
|
||||
|
||||
public DataSourcePropertiesConfiguration(ZookeeperDataSourceProperties zk) {
|
||||
this.zk = zk;
|
||||
}
|
||||
|
||||
public DataSourcePropertiesConfiguration(ApolloDataSourceProperties apollo) {
|
||||
this.apollo = apollo;
|
||||
}
|
||||
|
||||
public FileDataSourceProperties getFile() {
|
||||
return file;
|
||||
}
|
||||
|
@@ -101,4 +101,31 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
|
||||
public void setSecretKey(String secretKey) {
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
public static NacosDataSourceProperties buildFlowByEDAS() {
|
||||
return buildByEDAS("flow");
|
||||
}
|
||||
|
||||
public static NacosDataSourceProperties buildDegradeByEDAS() {
|
||||
return buildByEDAS("degrade");
|
||||
}
|
||||
|
||||
public static NacosDataSourceProperties buildByEDAS(String type) {
|
||||
NacosDataSourceProperties result = new NacosDataSourceProperties();
|
||||
result.setFactoryBeanName(
|
||||
NacosDataSourceWithAuthorizationFactoryBean.class.getName());
|
||||
result.setEndpoint(System.getProperties()
|
||||
.getProperty(SentinelDataSourceConstants.NACOS_DATASOURCE_ENDPOINT));
|
||||
result.setNamespace(System.getProperties()
|
||||
.getProperty(SentinelDataSourceConstants.NACOS_DATASOURCE_NAMESPACE));
|
||||
result.setAccessKey(System.getProperties()
|
||||
.getProperty(SentinelDataSourceConstants.NACOS_DATASOURCE_AK));
|
||||
result.setSecretKey(System.getProperties()
|
||||
.getProperty(SentinelDataSourceConstants.NACOS_DATASOURCE_SK));
|
||||
result.setDataType("json");
|
||||
result.setDataId(System.getProperties()
|
||||
.getProperty(SentinelDataSourceConstants.PROJECT_NAME) + "-" + type);
|
||||
result.setGroupId("nacos-sentinel");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user