Skip to content

Commit 2452ac8

Browse files
committed
fix(gateway): 修复apisix数据同步问题
- 移除create_time字段避免时间戳冲突 - 添加yaml内容类型头部确保正确解析 - 更新docker镜像版本到v2.7.8
1 parent 88fef5a commit 2452ac8

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ gateway等网关插件的高扩展性
99
### 通过docker运行
1010

1111
```bash
12-
docker run anjia0532/discovery-syncer-python:v2.7.7
12+
docker run anjia0532/discovery-syncer-python:v2.7.8
1313
```
1414

1515
特别的,`-c ` 支持配置远端http[s]的地址,比如读取静态资源的,比如读取nacos的

app/service/gateway/apisix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def fetch_admin_api_to_file(self, file_name: str):
159159
item_val = vv.get("value", vv)
160160
if item_val.get("status", 1) == 0:
161161
continue
162+
item_val.pop("create_time", None)
162163
item_val.pop("update_time", None)
163164
val[item.get("field")].append(item_val)
164165

tools/backup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def restore_{job.replace("-", "_")}_{gateway.replace("-", "_")}():
111111
check_file("{job}/{gateway}/{syncer['base_name']}")
112112
with open("{job}/{gateway}/{syncer['base_name']}", 'r', encoding='UTF-8') as f:
113113
resp = httpx.put("{syncer['syncer']}/restore/{gateway}", content="\\n".join(f.readlines()),
114-
headers={{"SYNCER-API-KEY": "{syncer['syncer_api_key']}"}}, verify=False).text
114+
headers={{
115+
"SYNCER-API-KEY": "{syncer['syncer_api_key']}",
116+
"Content-Type": "application/yaml"}}, verify=False).text
115117
print(f"还原 {job}/{gateway}/{syncer['base_name']}{syncer['syncer']}/restore/{gateway} , 结果为: {{resp}}")
116118
117119
""")

0 commit comments

Comments
 (0)