Files
warkanumandClaude Sonnet 5 ac3c0f149c
CI / js (push) Successful in 18s
CI / go (push) Successful in 36s
CI / rust (push) Successful in 2m3s
Add runnable smoke-test clients for each SDK
Each package gets a small example program that exercises the real
client: with no ORIGIN_SERVICE_KEY set it runs against a local mock
check-in server, otherwise it checks in against ORIGIN_URL/Origin's
public endpoint. Wired into CI (mock mode) as a regression check, and
documented per README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 15:38:37 +02:00
..

originclient (Go)

go get git.warky.dev/wdevs/origin_client/go

Usage

c, err := originclient.New(originclient.Config{
    ServiceKey: "...",
    Type:       "myservice",
    Version:    "1.2.3",
    Name:       "myservice-nova",
})
if err != nil {
    log.Fatal(err)
}
go c.Run(ctx) // immediate check-in, then every 24h until ctx is done

Call c.CheckinOnce(ctx) directly instead of Run to send a single check-in and observe the error/response.

Config

Field Required Default
ServiceKey yes
Type, Version, Name yes
URL no DefaultURL (https://origin.warky.dev/api/public/service-checkin)
AppType no "go"
Hostname no OS hostname
ContainerID no best-effort Docker/cgroup detection
Orchestrator no best-effort Kubernetes/Docker detection
InstallID no OS machine ID, else a generated UUID persisted to InstallIDPath
IntervalHours no DefaultIntervalHours (24)
Logger no discards warnings

Site, Environment, DatabaseType, DatabaseName, Port, BaseURL, InternalURL, Description are optional metadata with no default.

Hostname(), OutboundIP(), ContainerID(), Orchestrator(), and ResolveMachineID() are exported standalone for callers that want the detection logic without the HTTP client.

Manual smoke test

go run ./examples/testclient           # single check-in, local mock server
go run ./examples/testclient -watch    # loops via Run() until Ctrl-C

Set ORIGIN_SERVICE_KEY (and optionally ORIGIN_URL, ORIGIN_TYPE, ORIGIN_VERSION, ORIGIN_NAME, ORIGIN_SITE, ORIGIN_ENVIRONMENT, ORIGIN_INTERVAL_HOURS) to check in against a real endpoint instead.