feat(settings): 页面录入测试/生产 WeKnora 连接与密钥并收敛可达性判定
连接(地址 + 写-only 密钥)从文件引用搬进治理库:AES-GCM 密文 + 独立 0600 主密钥,
页面与接口只回显尾 4 位;测试连接真实列库并区分 地址不可达/密钥无效/无权限/成功,
换地址或换密钥必须测通才能保存(迁移 000083)。
可达性判定收敛为 weknora.HTTPAllowed,客户端与监控探活共用;新增
WEKNORA_ALLOW_PRIVATE_HTTP 只放行 RFC1918/回环/链路本地。生产绑定只保留下拉,
保存后回报冻结/未冻结条数,已冻结目标不被改写。
(cherry picked from commit ad02e8bb9c)
This commit is contained in:
@@ -3387,6 +3387,117 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/weknora-connections": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Settings"
|
||||
],
|
||||
"operationId": "listWeKnoraConnections",
|
||||
"summary": "读取测试/生产 WeKnora 连接状态(只回显密钥尾4位)",
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/Envelope"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/components/responses/BadRequest"
|
||||
},
|
||||
"500": {
|
||||
"$ref": "#/components/responses/InternalError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/weknora-connections/{environment}/test": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Settings"
|
||||
],
|
||||
"operationId": "testWeKnoraConnection",
|
||||
"summary": "用真实列库区分地址不可达/密钥无效/无权限/成功(管理员)",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "environment",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"test",
|
||||
"production"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/WeKnoraConnectionTest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/Envelope"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/components/responses/BadRequest"
|
||||
},
|
||||
"500": {
|
||||
"$ref": "#/components/responses/InternalError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/weknora-connections/{environment}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"Settings"
|
||||
],
|
||||
"operationId": "saveWeKnoraConnection",
|
||||
"summary": "保存测通的连接;密钥密文入库,响应只回尾4位(管理员)",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/IdempotencyKey"
|
||||
},
|
||||
{
|
||||
"name": "environment",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"test",
|
||||
"production"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/WeKnoraConnectionSave"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/Envelope"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/components/responses/BadRequest"
|
||||
},
|
||||
"500": {
|
||||
"$ref": "#/components/responses/InternalError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/ui-settings": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -5676,6 +5787,57 @@
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"WeKnoraConnectionTest": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"endpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"api_key": {
|
||||
"type": "string",
|
||||
"writeOnly": true
|
||||
},
|
||||
"key_action": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"keep",
|
||||
"replace",
|
||||
"clear"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"WeKnoraConnectionSave": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"endpoint",
|
||||
"key_action",
|
||||
"base_revision"
|
||||
],
|
||||
"properties": {
|
||||
"endpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"api_key": {
|
||||
"type": "string",
|
||||
"writeOnly": true
|
||||
},
|
||||
"key_action": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"keep",
|
||||
"replace",
|
||||
"clear"
|
||||
]
|
||||
},
|
||||
"base_revision": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"QAReportedHistoricalRate": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
Reference in New Issue
Block a user