Skip to content

Commit

Permalink
optimize: support configuration metadata read from environment variab…
Browse files Browse the repository at this point in the history
…les (apache#4359)
  • Loading branch information
slievrly authored Feb 16, 2022
1 parent 732f287 commit 031f4c3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions changes/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#4303](https://github.com/seata/seata/pull/4303)] `tcc_fence_log`表悬挂日志记录异步删除
- [[#4328](https://github.com/seata/seata/pull/4328)] 配置上传脚本支持注释
- [[#4336](https://github.com/seata/seata/pull/4336)] 添加AT模式不支持的SQL语句异常提示
- [[#4353](https://github.com/seata/seata/pull/4353)] `seata-all.jar` 瘦身。

- [[#4359](https://github.com/seata/seata/pull/4359)] 支持配置元数据读取环境变量
- [[#4353](https://github.com/seata/seata/pull/4353)]`seata-all.jar` 瘦身。


### test:
Expand Down
2 changes: 1 addition & 1 deletion changes/en-us/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@
- [[#4303](https://github.com/seata/seata/pull/4303)] `tcc_fence_log` table hanging log records are deleted asynchronously
- [[#4328](https://github.com/seata/seata/pull/4328)] upload configuration script support comments
- [[#4336](https://github.com/seata/seata/pull/4336)] add SQL exception prompt not supported by AT mode
- [[#4359](https://github.com/seata/seata/pull/4359)] support configuration metadata read from environment variables
- [[#4353](https://github.com/seata/seata/pull/4353)] Slimming down for the `seata-all.jar`



### test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ default String getConfigFromSys(String dataId) {
if (null != content) {
return content;
}
String envDataId = dataId.toUpperCase().replace(".", "_");
content = ENV_MAP.get(envDataId);
if (null != content) {
return content;
}
return System.getProperty(dataId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ public Object intercept(Object proxy, Method method, Object[] args, MethodProxy
if (method.getName().startsWith(INTERCEPT_METHOD_PREFIX) && args.length > 0) {
Object result = null;
String rawDataId = (String) args[0];
if (args.length == 1) {
result = get(convertDataId(rawDataId));
} else {
result = get(convertDataId(rawDataId), args[1]);
result = originalConfiguration.getConfigFromSys(rawDataId);
if (null == result) {
if (args.length == 1) {
result = get(convertDataId(rawDataId));
} else {
result = get(convertDataId(rawDataId), args[1]);
}
}
if (result != null) {
//If the return type is String,need to convert the object to string
Expand Down

0 comments on commit 031f4c3

Please sign in to comment.