feat(tools): the shared client plumbing
A client tool is three moves: read the connection from the environment, make one HTTP call carrying the bearer and the contract header, and print either the answer as one JSON line or the one error shape — then exit with the code that says which happened. Common is those three moves, so no client reimplements them and all clients fail identically: `Config::from_env` (`RHEMA_URL`, `RHEMA_TOKEN`), the `Client` call with the contract envelope, `print`/`fail` and the `ToolError` exit codes. The HTTP client is `ureq`, blocking, no TLS: the contract speaks to a loopback or otherwise trusted daemon, and a remote TLS endpoint is a stated non-goal in v1 — a thin client stays thin.
This commit is contained in:
1 parent
75585f2dd3
commit
29099add9d
2 files changed
+182
No files matched your search
@@ -0,0 +1,20 @@
|
||||
[package]
|
||||
name = "rhema-tools-common"
|
||||
description = "Shared plumbing for the rhema claw's thin client tools: connection config, the HTTP calls, the one error shape, the exit codes"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
rhema-tools-contract = { path = "../contract" }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
ureq.workspace = true
|
||||
|
||||
[lints.rust]
|
||||
unsafe_code = "forbid"
|
||||
missing_docs = "deny"
|
||||
Reference in new issue
Block a user