Refactored, added comprehensive testing.
All checks were successful
Release / release (push) Successful in 3m17s
All checks were successful
Release / release (push) Successful in 3m17s
This commit is contained in:
17
config/validate.go
Normal file
17
config/validate.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func validateConfig(cfg ConfigData) error {
|
||||
if cfg.APIKey == "" {
|
||||
return fmt.Errorf("API key required: use --key, --key-file, AICLI_API_KEY, AICLI_API_KEY_FILE, or key_file in config")
|
||||
}
|
||||
|
||||
if cfg.Protocol != ProtocolOpenAI && cfg.Protocol != ProtocolOllama {
|
||||
return fmt.Errorf("invalid protocol: must be openai or ollama")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user