连接(地址 + 写-only 密钥)从文件引用搬进治理库:AES-GCM 密文 + 独立 0600 主密钥, 页面与接口只回显尾 4 位;测试连接真实列库并区分 地址不可达/密钥无效/无权限/成功, 换地址或换密钥必须测通才能保存(迁移 000083)。 可达性判定收敛为 weknora.HTTPAllowed,客户端与监控探活共用;新增 WEKNORA_ALLOW_PRIVATE_HTTP 只放行 RFC1918/回环/链路本地。生产绑定只保留下拉, 保存后回报冻结/未冻结条数,已冻结目标不被改写。
This commit is contained in:
@@ -31,28 +31,33 @@ type Config struct {
|
||||
ProductionWeKnoraBaseURL string
|
||||
ProductionWeKnoraAPIKeyFile string
|
||||
ProductionWeKnoraAllowDockerHTTP bool
|
||||
PPScanEnabled bool
|
||||
PPScanAllowedRoot string
|
||||
PPScanLedgerPath string
|
||||
PPScanManifestPath string
|
||||
TestWeKnoraEnabled bool
|
||||
TestWeKnoraAllowDockerHTTP bool
|
||||
TestWeKnoraBaseURL string
|
||||
MinerUBaseURL string
|
||||
TestWeKnoraKBID string
|
||||
InternalRoutingKnowledgeBaseID string
|
||||
ExternalRoutingKnowledgeBaseID string
|
||||
TestWeKnoraAPIKeyFile string
|
||||
GovernanceSpoolRoot string
|
||||
IngestionSpoolRoot string
|
||||
ArtifactFetchMaxBytes int64
|
||||
WorkerLivenessStaleAfter time.Duration
|
||||
TestWeKnoraHTTPTimeout time.Duration
|
||||
TestWeKnoraPollInitial time.Duration
|
||||
TestWeKnoraPollMax time.Duration
|
||||
TestWeKnoraStalledAfter time.Duration
|
||||
TestWeKnoraMaxUploadBytes int64
|
||||
TestAcceptancePolicyVersion string
|
||||
// 连接(地址 + 写-only 密钥)密文存治理库;主密钥是独立的 0600 文件。
|
||||
WeKnoraBindingMasterKeyFile string
|
||||
// 允许同网段 http(生产 18093 反代)与可信 TLS 反代后录入密钥。
|
||||
WeKnoraAllowPrivateHTTP bool
|
||||
WeKnoraBindingTrustTLSProxy bool
|
||||
PPScanEnabled bool
|
||||
PPScanAllowedRoot string
|
||||
PPScanLedgerPath string
|
||||
PPScanManifestPath string
|
||||
TestWeKnoraEnabled bool
|
||||
TestWeKnoraAllowDockerHTTP bool
|
||||
TestWeKnoraBaseURL string
|
||||
MinerUBaseURL string
|
||||
TestWeKnoraKBID string
|
||||
InternalRoutingKnowledgeBaseID string
|
||||
ExternalRoutingKnowledgeBaseID string
|
||||
TestWeKnoraAPIKeyFile string
|
||||
GovernanceSpoolRoot string
|
||||
IngestionSpoolRoot string
|
||||
ArtifactFetchMaxBytes int64
|
||||
WorkerLivenessStaleAfter time.Duration
|
||||
TestWeKnoraHTTPTimeout time.Duration
|
||||
TestWeKnoraPollInitial time.Duration
|
||||
TestWeKnoraPollMax time.Duration
|
||||
TestWeKnoraStalledAfter time.Duration
|
||||
TestWeKnoraMaxUploadBytes int64
|
||||
TestAcceptancePolicyVersion string
|
||||
// TestAutoReviewPolicy:验收通过后是否自动批准(off|internal|all;默认 internal)。
|
||||
TestAutoReviewPolicy string
|
||||
// 目标库所在主机(整库逻辑备份真正执行的地方)。凭据是挂载进来的 0600 ssh
|
||||
@@ -168,6 +173,7 @@ func Load(getenv func(string) string) (Config, error) {
|
||||
ProductionReleaseAuthTokenFile: strings.TrimSpace(getenv("PRODUCTION_RELEASE_AUTH_TOKEN_FILE")),
|
||||
ProductionWeKnoraBaseURL: strings.TrimSpace(getenv("PRODUCTION_WEKNORA_BASE_URL")),
|
||||
ProductionWeKnoraAPIKeyFile: strings.TrimSpace(getenv("PRODUCTION_WEKNORA_API_KEY_FILE")),
|
||||
WeKnoraBindingMasterKeyFile: strings.TrimSpace(getenv("WEKNORA_BINDING_MASTER_KEY_FILE")),
|
||||
PPScanAllowedRoot: strings.TrimSpace(getenv("PP_SCAN_ALLOWED_ROOT")),
|
||||
PPScanLedgerPath: strings.TrimSpace(getenv("PP_SCAN_LEDGER_PATH")),
|
||||
PPScanManifestPath: strings.TrimSpace(getenv("PP_SCAN_MANIFEST_PATH")),
|
||||
@@ -288,6 +294,21 @@ func Load(getenv func(string) string) (Config, error) {
|
||||
return Config{}, fmt.Errorf("PRODUCTION_WEKNORA_BASE_URL: %w", err)
|
||||
}
|
||||
}
|
||||
if raw := getenv("WEKNORA_ALLOW_PRIVATE_HTTP"); raw != "" {
|
||||
config.WeKnoraAllowPrivateHTTP, err = strconv.ParseBool(raw)
|
||||
if err != nil {
|
||||
return Config{}, fmt.Errorf("WEKNORA_ALLOW_PRIVATE_HTTP: %w", err)
|
||||
}
|
||||
}
|
||||
if raw := getenv("WEKNORA_BINDING_TRUST_TLS_PROXY"); raw != "" {
|
||||
config.WeKnoraBindingTrustTLSProxy, err = strconv.ParseBool(raw)
|
||||
if err != nil {
|
||||
return Config{}, fmt.Errorf("WEKNORA_BINDING_TRUST_TLS_PROXY: %w", err)
|
||||
}
|
||||
}
|
||||
if config.WeKnoraBindingMasterKeyFile != "" && !filepath.IsAbs(config.WeKnoraBindingMasterKeyFile) {
|
||||
return Config{}, errors.New("WEKNORA_BINDING_MASTER_KEY_FILE must be an absolute path")
|
||||
}
|
||||
if config.ProductionWeKnoraAPIKeyFile != "" {
|
||||
if config.ProductionWeKnoraBaseURL == "" {
|
||||
return Config{}, errors.New("PRODUCTION_WEKNORA_API_KEY_FILE requires PRODUCTION_WEKNORA_BASE_URL")
|
||||
|
||||
Reference in New Issue
Block a user