fix(backend): harden write registrar boundaries

This commit is contained in:
2026-07-21 16:12:20 +08:00
parent 1fcbb31301
commit 80bec26839
17 changed files with 639 additions and 42 deletions

View File

@@ -13,6 +13,7 @@ type Config struct {
Port string `yaml:"port"`
DSN string `yaml:"dsn"`
StorageDir string `yaml:"storage_dir"`
MaxUploadBytes int64 `yaml:"max_upload_bytes"`
AuthSecret string `yaml:"auth_secret"`
SystemAIKey string `yaml:"system_ai_key"`
AIKeyEncryptionSecret string `yaml:"ai_key_encryption_secret"`
@@ -41,5 +42,8 @@ func LoadFromDir(configDir string) (Config, error) {
if err := yaml.Unmarshal(data, &cfg); err != nil {
return Config{}, err
}
if cfg.MaxUploadBytes <= 0 {
cfg.MaxUploadBytes = 32 << 20
}
return cfg, nil
}