Secret

Create and fetch secrets from onboardbase

The secrets command provides an interface to interact directly with the secrets on Onboardbase. It supports different export formats making it useful in different scenarios.

secrets

The secrets command exports all the secrets for an environment of a project into a JSON string and output the result to the console.

onboardbase secrets -p [PROJECT NAME] -e [ENVIRONMENT NAME]

Options

  • -p, --project: The name of the secrets
  • -e, --environment: The name of the environment to fetch from
  • --json: Logs the secrets as JSON key-value pairs
  • --raw: Logs the secrets as a table format
  • --yaml: Logs the secrets as yaml format
  • --docker: Logs the secrets as docker format
  • --env: Logs the secrets as env

secrets:upload

This command uploads a secret or multiple secrets into a project.

πŸ“˜

The secrets to upload have to be a valid JSON stringified Key-Value pairs or using a Key & Value structure

JSON

onboardbase secrets:upload -p [PROJECT NAME] -e [ENVIRONMENT NAME] '{"name":"value", "db_url": "value"}'

Key & Value

onboardbase secrets:upload -p [PROJECT NAME] -e [ENVIRONMENT NAME] --secrets "NAME=value DB_URL=value"

Options

  • -p, --project: The name of the secrets
  • -e, --environment: The name of the environment to fetch from
  • --secrets : This allows you to upload using the key & value structure

Example:

onboardbase secrets:upload -p sales -e tools '{"name":"value", "db_url": "value"}'

secrets:update

Update secrete or multiple secrets into a project.

πŸ“˜

The secrets to upload have to be a KEY=VALUE pairs separated by space.

onboardbase secrets:update -p [PROJECT NAME] -e [ENVIRONMENT NAME] ["SECRETS"]

Options

  • -p, --project: The name of the secrets
  • -e, --environment: The name of the environment to fetch from

Example:

onboardbase secrets:update -p sales -e tools "KEY=VALUE"

secrets:fetch

Retrieve a secret from the command line based on the name.

onboardbase secrets:fetch -p [PROJECT NAME] -e [ENVIRONMENT NAME] [KEY NAME]

Example:

onboardbase secrets:fetch -p sales -e tools SECRET_KEY

secrets:delete

Delete secrete or multiple secrets from a project.

πŸ“˜

The name of the secrets to delete should be a string separated by space.

For example, to delete KEY_ONE and KEY_TWO from a project, the [SECRETS] argument would look like: KEY_ONE KEY_TWO

onboardbase secrets:delete -p [PROJECT NAME] -e [ENVIRONMENT NAME] ["SECRETS"]

Options

  • -p, --project: The name of the secrets
  • -e, --environment: The name of the environment to fetch from

Example :

onboardbase secrets:delete -p sales -e tools "KEY_ONE KEY_TWO"

secrets:download

You can download your secrets to JSON, YAML, and ENV through the Onboardbase CLI.

onboardbase secrets:download --json
onboardbase secrets:download --yaml
onboardbase secrets:download --env
onboardbase secrets:download --docker
onboardbase secrets --bash

// *** usage ***

// Pull and record all onboardbase secrets as a bash script
onboardbase secrets --bash > /tmp/secrets.sh
chmod +x secrets.sh

// load the file into the current process
source secrets.sh

// Cleanup sourced secrets
rm /tmp/secrets.sh

//printenv to print all available envs in the current process