Add the Config view: edit and save the settings, applied without a restart

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 23:31:13 +02:00
co-authored by Claude Sonnet 5.5
parent 0ccd02b3c5
commit a4ec9ad71e
25 changed files with 1168 additions and 54 deletions
+19
View File
@@ -122,3 +122,22 @@ func TestTransportErrorHidesAPIKey(t *testing.T) {
t.Errorf("error leaks API key: %v", err)
}
}
func TestReconfigure(t *testing.T) {
var gotKey string
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
gotKey = r.URL.Query().Get("apikey")
w.Write([]byte(`{"version":"5.1"}`))
}))
defer srv.Close()
c := NewClient("http://127.0.0.1:1", "old") // unreachable until reconfigured
if _, err := c.Version(context.Background()); err == nil {
t.Fatal("expected a connection error")
}
c.Reconfigure(srv.URL+"/", "new")
v, err := c.Version(context.Background())
if err != nil || v != "5.1" || gotKey != "new" {
t.Errorf("version=%q key=%q err=%v", v, gotKey, err)
}
}