Getting started with the PK CLI1 min read.
In this tutorial we’ll cover how to setup and configure the “pk” command line tool, for both interactive
and non interactive use. With the pk cli you can:
- Run commands and programs (even a bash shell) with pre-configured environments.
- Combine several environments to pull in the environment variables you want.
- Get secrets, notes and software keys.
- Connect to databases from a universal sql command line (or use your favourite db tool).
The pk cli can be configured in three ways:
- Using a config file
- Via environment variables
- Interactively typing your username and password
We assume you already have an account setup with PKHub.
The rest of the tutorial assumes you have acccess to a command line terminal, and all commands when run will be executed in the command line terminal.
To install run the following command:
curl https://docs.pkhub.io/install/install.sh | sh
Interactive user name and password
-p flag in the
pk command, will ask you for your user name and password
This is an easy way to login and use the pk command.
pk sh -p -s [your-safe] -n [any-env] -i -- bash
Configuration via Environment Variables
You can create and manage API keys in the pkbhub account section. Which is made visible by clicking on your login name.
Set the keys in your
export PK_KEY_ID=[PK KEY ID] export PK_KEY_SECRET=[PK KEY SECRET]
Configuration via config file
You can also store your pk API keys in a config file if you whish (although environment variables is the preferred way).
Use the file:
#~/.pk.yaml PK_KEY_ID: [PK KEY ID] PK_KEY_SECRET: [PK KEY SECRET]