feat: add remote NodeService client backed by the HTTP API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 13:18:31 +02:00
parent 3dfc46c3ff
commit 7292751ef7
4 changed files with 141 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import (
"axolotl/models"
"axolotl/store"
"fmt"
"net/http"
)
// NodeService is the single entry point for all node operations.
@@ -76,6 +77,10 @@ func GetNodeService(cfg Config) (NodeService, error) {
if user == "" {
return nil, fmt.Errorf("no user configured: run 'ax user set <username>' first")
}
if rc, ok := cfg.GetRemoteConfig(); ok {
base := fmt.Sprintf("http://%s:%d", rc.Host, rc.Port)
return &apiClient{base: base, user: user, http: &http.Client{}}, nil
}
st, err := store.FindAndOpenSQLiteStore()
if err != nil {
return nil, err