连接(地址 + 写-only 密钥)从文件引用搬进治理库:AES-GCM 密文 + 独立 0600 主密钥, 页面与接口只回显尾 4 位;测试连接真实列库并区分 地址不可达/密钥无效/无权限/成功, 换地址或换密钥必须测通才能保存(迁移 000083)。 可达性判定收敛为 weknora.HTTPAllowed,客户端与监控探活共用;新增 WEKNORA_ALLOW_PRIVATE_HTTP 只放行 RFC1918/回环/链路本地。生产绑定只保留下拉, 保存后回报冻结/未冻结条数,已冻结目标不被改写。
This commit is contained in:
@@ -13,6 +13,17 @@ import (
|
||||
// the operator to paste an id. A missing endpoint or credential is an error the
|
||||
// caller reports honestly rather than a silently empty picker.
|
||||
func (verifier *Verifier) ListProductionKnowledgeBases(ctx context.Context, baseURL string) ([]weknora.KnowledgeBase, error) {
|
||||
// The admin-managed connection wins: the page is where operators record the
|
||||
// endpoint and key, and a second (file) source would silently disagree.
|
||||
if verifier.config.ConnectionResolver != nil {
|
||||
if endpoint, apiKey, ok := verifier.config.ConnectionResolver.Resolve(ctx, "production"); ok {
|
||||
client, err := verifier.clientWithPolicy(endpoint, apiKey, verifier.config.ProductionAllowDockerHTTP, verifier.config.ProductionAllowPrivateHTTP)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client.ListKnowledgeBases(ctx)
|
||||
}
|
||||
}
|
||||
resolved := firstNonEmpty(baseURL, verifier.config.ProductionBaseURLFallback)
|
||||
if resolved == "" {
|
||||
return nil, errors.New("production WeKnora endpoint is not configured")
|
||||
@@ -21,7 +32,7 @@ func (verifier *Verifier) ListProductionKnowledgeBases(ctx context.Context, base
|
||||
if apiKey == "" {
|
||||
return nil, errors.New("production WeKnora API key file is not available")
|
||||
}
|
||||
client, err := verifier.client(resolved, apiKey, verifier.config.ProductionAllowDockerHTTP)
|
||||
client, err := verifier.clientWithPolicy(resolved, apiKey, verifier.config.ProductionAllowDockerHTTP, verifier.config.ProductionAllowPrivateHTTP)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user