aboutsummaryrefslogtreecommitdiff
path: root/src/nix/ping-store.cc
diff options
context:
space:
mode:
authormatthewcroughan <matt@croughan.sh>2022-12-26 20:21:08 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-06 19:59:57 -0400
commit9207f945822764a041a485009759f0a895468e94 (patch)
tree8eb60530be71b451d588d493dde52efe86ea30ff /src/nix/ping-store.cc
parent91856396317995aa38dc7244357596b8de27f937 (diff)
Add `Store::isTrustedClient()`
This function returns true or false depending on whether the Nix client is trusted or not. Mostly relevant when speaking to a remote store with a daemon. We include this information in `nix ping store` and `nix doctor` Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>
Diffstat (limited to 'src/nix/ping-store.cc')
-rw-r--r--src/nix/ping-store.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nix/ping-store.cc b/src/nix/ping-store.cc
index 5c44510ab..ec450e8e0 100644
--- a/src/nix/ping-store.cc
+++ b/src/nix/ping-store.cc
@@ -28,15 +28,20 @@ struct CmdPingStore : StoreCommand, MixJSON
store->connect();
if (auto version = store->getVersion())
notice("Version: %s", *version);
+ if (auto trusted = store->isTrustedClient())
+ notice("Trusted: %s", *trusted);
} else {
nlohmann::json res;
Finally printRes([&]() {
logger->cout("%s", res);
});
+
res["url"] = store->getUri();
store->connect();
if (auto version = store->getVersion())
res["version"] = *version;
+ if (auto trusted = store->isTrustedClient())
+ res["trusted"] = *trusted;
}
}
};