feat(ocr): 新增本地 OCR sidecar
This commit is contained in:
@@ -21,6 +21,7 @@ type Config struct {
|
||||
FieldEncryptionLegacyKey string
|
||||
ExternalUploadSecret string
|
||||
ExternalUploadAllowedIPs []string
|
||||
OCRServiceURL string
|
||||
BootstrapAdminUsername string
|
||||
BootstrapAdminPassword string
|
||||
BootstrapAdminNickname string
|
||||
@@ -105,6 +106,7 @@ func Load() Config {
|
||||
FieldEncryptionLegacyKey: fieldEncryptionLegacyKey(getEnv("APP_ENV", "development")),
|
||||
ExternalUploadSecret: getEnv("EXTERNAL_UPLOAD_SECRET", ""),
|
||||
ExternalUploadAllowedIPs: getEnvList("EXTERNAL_UPLOAD_ALLOWED_IPS"),
|
||||
OCRServiceURL: strings.TrimRight(strings.TrimSpace(getEnv("OCR_SERVICE_URL", "")), "/"),
|
||||
BootstrapAdminUsername: getEnv("ADMIN_BOOTSTRAP_USERNAME", ""),
|
||||
BootstrapAdminPassword: getEnv("ADMIN_BOOTSTRAP_PASSWORD", ""),
|
||||
BootstrapAdminNickname: getEnv("ADMIN_BOOTSTRAP_NICKNAME", "超级管理员"),
|
||||
|
||||
@@ -111,6 +111,13 @@ func TestLoadDatabaseConfigInvalidValuesUseDefaults(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadOCRServiceURL(t *testing.T) {
|
||||
t.Setenv("OCR_SERVICE_URL", " http://ocr:8787/ ")
|
||||
if got := Load().OCRServiceURL; got != "http://ocr:8787" {
|
||||
t.Fatalf("OCRServiceURL = %q, want http://ocr:8787", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestFieldEncryptionLegacyKeyNonProductionDefaultsToHistoric 验证非生产环境未设置 legacy 时
|
||||
// 回退到历史硬编码密钥(开发态零配置兼容旧密文)。
|
||||
func TestFieldEncryptionLegacyKeyNonProductionDefaultsToHistoric(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user