Refactored, added comprehensive testing.
All checks were successful
Release / release (push) Successful in 3m17s

This commit is contained in:
Jay
2025-10-26 23:23:43 -04:00
parent ec32b75267
commit 1936f055e2
61 changed files with 4678 additions and 769 deletions

34
config/env.go Normal file
View File

@@ -0,0 +1,34 @@
package config
import "os"
import "strings"
func loadEnvironment() envValues {
ev := envValues{}
if val := os.Getenv("AICLI_PROTOCOL"); val != "" {
ev.protocol = val
}
if val := os.Getenv("AICLI_URL"); val != "" {
ev.url = val
}
if val := os.Getenv("AICLI_API_KEY"); val != "" {
ev.key = val
} else if val := os.Getenv("AICLI_API_KEY_FILE"); val != "" {
content, err := os.ReadFile(val)
if err == nil {
ev.key = strings.TrimSpace(string(content))
}
}
if val := os.Getenv("AICLI_MODEL"); val != "" {
ev.model = val
}
if val := os.Getenv("AICLI_FALLBACK"); val != "" {
ev.fallback = val
}
if val := os.Getenv("AICLI_SYSTEM"); val != "" {
ev.system = val
}
return ev
}