chore: align forest AI development setup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -45,5 +46,18 @@ func LoadFromDir(configDir string) (Config, error) {
|
||||
if cfg.MaxUploadBytes <= 0 {
|
||||
cfg.MaxUploadBytes = 32 << 20
|
||||
}
|
||||
if strings.TrimSpace(cfg.StorageDir) == "" {
|
||||
return Config{}, fmt.Errorf("storage_dir must not be empty")
|
||||
}
|
||||
hasAllowedOrigin := false
|
||||
for _, origin := range cfg.AllowedOrigins {
|
||||
if strings.TrimSpace(origin) != "" {
|
||||
hasAllowedOrigin = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasAllowedOrigin {
|
||||
return Config{}, fmt.Errorf("allowed_origins must include at least one origin")
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user