Refactor config package validation

This commit is contained in:
dwrz
2026-09-26 17:20:32 +00:00
parent 2391aa32d2
commit bf6971e470
2 changed files with 51 additions and 2 deletions
+3 -1
View File
@@ -125,7 +125,6 @@ type JobConfig struct {
// Timeout limits the job execution time (e.g., "10m").
Timeout time.Duration `yaml:"timeout,omitempty"`
// UserId identifies the user that owns conversations created by this job.
// It is assigned by the service until jobs are stored in the database.
UserId string `yaml:"user_id,omitempty"`
}
@@ -145,6 +144,9 @@ func (cfg JobConfig) Validate() error {
if cfg.Timeout < 0 {
return fmt.Errorf("invalid timeout %v: must not be negative", cfg.Timeout)
}
if cfg.UserId == "" {
return fmt.Errorf("missing user_id")
}
return nil
}