feat: wire configured harness execution

This commit is contained in:
kami
2026-07-26 20:06:44 +04:00
parent 5d45351613
commit dc3cebebf8
5 changed files with 71 additions and 3 deletions
+14
View File
@@ -8,7 +8,9 @@ import (
"net/http"
"orchestra/internal/authz"
"orchestra/internal/domain"
"orchestra/internal/herdr"
"orchestra/internal/operations"
"orchestra/internal/orchestrator"
"orchestra/internal/provider"
"orchestra/internal/registry"
"orchestra/internal/router"
@@ -36,6 +38,18 @@ func main() {
log.Fatalf("load orchestra config: %v", err)
}
rt = &router.Router{Store: s, Registry: rr, Reachability: registry.TCPReachability{}, Timeout: time.Second, Retry: router.RetryPolicy{MaxAttempts: 3, Backoff: time.Minute}}
if repo, root := os.Getenv("ORCHESTRA_REPO"), os.Getenv("ORCHESTRA_WORKTREE_ROOT"); repo != "" && root != "" {
adapters := map[string]herdr.Adapter{}
for _, h := range rr.Herdrs() {
if h.Address == "" {
continue
}
client := herdr.New(h.Address)
adapters[h.ID] = herdr.Codex(client, 200000)
}
coordinator := &orchestrator.Coordinator{Store: s, Worktrees: orchestrator.GitWorktrees{Root: root, Repo: repo}, Adapters: orchestrator.AdapterFactory{Herdrs: adapters}}
rt.OnLease = func(e domain.Event) error { return coordinator.Start(context.Background(), e) }
}
}
mux := http.NewServeMux()
surface := func(r *http.Request) authz.Surface {