Overview

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:
  1. 1. Using a config file
  2. 2. Via environment variables
  3. 3. Interactively typing your username and password

Requirements

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.

Installation

To install run the following command:
curl https://docs.pkhub.io/install/install.sh | sh

Config

Interactive user name and password

Using the "-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 "~/.bashrc" or "~/.zshrc" files.

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.yaml
PK_KEY_ID: [PK KEY ID]
PK_KEY_SECRET: [PK KEY SECRET]