Add database config
This commit is contained in:
@@ -41,6 +41,19 @@ func (cfg TTS) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Database holds the SQLite database configuration.
|
||||
type Database struct {
|
||||
// Path is the filesystem path to the SQLite database file.
|
||||
Path string `yaml:"path"`
|
||||
}
|
||||
|
||||
func (cfg Database) Validate() error {
|
||||
if cfg.Path == "" {
|
||||
return fmt.Errorf("missing path")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// STT holds the configuration for the frontend-facing speech-to-text server.
|
||||
type STT struct {
|
||||
// URL is the base URL of the whisper-server.
|
||||
@@ -115,6 +128,9 @@ type JobConfig struct {
|
||||
Task string `yaml:"task"`
|
||||
// Timeout limits the job execution time (e.g., "10m").
|
||||
Timeout string `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"`
|
||||
}
|
||||
|
||||
func (cfg JobConfig) Validate() error {
|
||||
@@ -130,6 +146,7 @@ func (cfg JobConfig) Validate() error {
|
||||
if cfg.MaxIterations < 0 {
|
||||
return fmt.Errorf("max_iterations must be non-negative")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -171,6 +188,8 @@ func (cfg ToolConfig) Validate() error {
|
||||
type Config struct {
|
||||
// Address is the host:port to listen on.
|
||||
Address string `yaml:"address"`
|
||||
// Database configures the SQLite database path.
|
||||
Database Database `yaml:"database"`
|
||||
// ShutdownTimeout is the maximum time to wait for graceful shutdown.
|
||||
ShutdownTimeout string `yaml:"shutdown_timeout"`
|
||||
// shutdownTimeout is the parsed duration, set during Load.
|
||||
@@ -211,6 +230,9 @@ func (cfg *Config) Validate() error {
|
||||
if cfg.Address == "" {
|
||||
return fmt.Errorf("address required")
|
||||
}
|
||||
if err := cfg.Database.Validate(); err != nil {
|
||||
return fmt.Errorf("invalid database config: %w", err)
|
||||
}
|
||||
if cfg.DefaultModel.Provider == "" {
|
||||
return fmt.Errorf("default_model.provider required")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user