Upgrades to Live and API Caching

This commit is contained in:
2026-03-27 00:30:53 -04:00
parent 7c2fcfef8d
commit 360bde4602
19 changed files with 838 additions and 225 deletions

View File

@@ -11,7 +11,17 @@ import (
)
func main() {
client := api.NewOpenF1Client("https://api.openf1.org", 15*time.Second)
var client *api.OpenF1Client
if apiKey := os.Getenv("OPENF1_API_KEY"); apiKey != "" {
client = api.NewOpenF1ClientWithKey("https://api.openf1.org", 15*time.Second, apiKey)
} else {
client = api.NewOpenF1Client("https://api.openf1.org", 15*time.Second)
}
defer client.Close()
// Clean up old file-based cache (one-time migration).
go api.CleanupOldFileCache()
model := ui.NewAppModel(client)
p := tea.NewProgram(