The CLI for Polykey is the first real
gRPC functionality. It uses the
PolykeyClient class which wraps a
gRPC client along with a few other things.
PolykeyClient starts, it attempts to connect to a running
PolykeyAgent's gRPC server. If a connection cannot be established, the user is informed of it.
When the user calls a CLI command, e.g.
>$ pk vaults ls
A few things happen.
PolykeyClientobject gets created and is started, (attemping to connect to the
- PolykeyClient sends a
gRPCrequest to the
PolykeyAgentwhich responds with the appropriate information, or performs the appropriate action
- Any relevant information is displayed to the user
Configuration from lockfile
There exists a file in the filesystem, in the polykey path that contains information about a
PolykeyAgent if it is running.
It will be guaranteed to contain the following:
PID: Process ID
GRPCHOST: The host address of the grpc server that is running
GRPCPORT: The port of the grpc server that is running
This file gets deleted when the PolykeyAgent is stopped.
The CLI will read from this file when it creates the
PolykeyClient and use it to determine whether or not a
PolykeyAgent is running, and how to connect to it.