Documentation
¶
Overview ¶
Example: server_embedded — running the ChronosOS control plane as a library.
What you'll learn:
- How to construct a chronosos.Server with chronosos.NewWithOptions
- How to enable API-key authentication, RBAC, and the Swagger UI
- How to start the server and shut it down gracefully on SIGINT/SIGTERM
ChronosOS is the HTTP control plane (sessions, traces, events, approvals, metrics). Instead of running the `chronos serve` CLI you can embed the same server inside your own Go binary, wiring it to your storage backend.
This example compiles with no credentials. The Handler() it builds is what the accompanying test exercises in-process with net/http/httptest, so CI never binds a port.
Run:
go run ./examples/server_embedded/ # serves on :8420 until Ctrl-C curl http://localhost:8420/health/ready curl -H "X-Api-Key: dev-secret-key" http://localhost:8420/api/sessions open http://localhost:8420/swagger/
Click to show internal directories.
Click to hide internal directories.