Skip to Content

CLI Reference

Provisioning commands are exposed by onprest-gateway.

Generate Agent Secret

./onprest-gateway create-agent-secret

Outputs an Ed25519 private key and public key.

  • private key: capability.yaml gateway.agent_private_key
  • public key: gateway.env GATEWAY_AGENT_PUBLIC_KEY

Compatible alias:

./onprest-gateway create-agent

Generate API Key

./onprest-gateway create-key --name internal --capabilities "*" ./onprest-gateway create-key --name partner-a --capabilities "get_customer,get_orders"

The command outputs a plaintext API key and bcrypt key_hash. Store only the hash in GATEWAY_API_KEYS_JSON. Give the plaintext key to the caller once.

Start Agent

./onprest-agent --config ./capability.yaml

--config selects the capability YAML file. If omitted, the agent checks AGENT_CAPABILITY_FILE, then falls back to capability.yaml next to the onprest-agent binary.

Agent Service Commands

./onprest-agent service install --config /absolute/path/capability.yaml ./onprest-agent service start ./onprest-agent service stop ./onprest-agent service status ./onprest-agent service uninstall

The service commands register and control the agent through the host OS service manager: systemd on Linux, launchd on macOS, and Windows Service on Windows. If install omits --config, it registers capability.yaml next to the onprest-agent binary. install does not enable automatic start on OS boot.

Build

make build

Expected outputs:

dist/onprest-gateway dist/onprest-agent

Cross Build

make build-cross

This writes OS-specific artifacts under dist/<os>-<arch>/, for example:

dist/linux-amd64/onprest-gateway dist/linux-amd64/onprest-agent dist/linux-arm64/onprest-gateway dist/linux-arm64/onprest-agent dist/darwin-amd64/onprest-gateway dist/darwin-amd64/onprest-agent dist/darwin-arm64/onprest-gateway dist/darwin-arm64/onprest-agent dist/windows-amd64/onprest-gateway.exe dist/windows-amd64/onprest-agent.exe

The binaries are built with CGO_ENABLED=0, so they are suitable for copying to legacy environments without installing Docker or native database client libraries.