Skip to content
/ cli Public

Securely manage and sync environment variables with Phase.

License

Notifications You must be signed in to change notification settings

phasehq/cli

Repository files navigation

Phase-CLI

Ξ» phase
Securely manage application secrets and environment variables with Phase.

                     @@@
              @@@@@@@@@@
          @@@@@@@@@@@@@@@@
       P@@@@@&@@@?&@@&@@@@@P
     P@@@@#        @&@    @P@@@
    &@@@#         *@&      #@@@&
   &@@@5          &@?       5@@@&
  Y@@@#          ^@@         #@@@J
  #@@@7          B@5         7@@@#
  #@@@?         .@@.         ?@@@#
  @@@@&         5@G          &@@@7
   #@@@B        @@^         #@@@B
    B@@@@      .@#        7@@@@B
     @@@@@@    &.@       P@@@@@7
       @@@@@@@@@@@@@@@@@@@@@
          @@@@@@@@@@@@@@@
             @@@@@@@@
             @@@

options:
  -h, --help   show this help message and exit
  --version, -v
               show program's version number and exit


Commands:

    auth             πŸ’» Authenticate with Phase
    init             πŸ”— Link your project with your Phase app
    run              πŸš€ Run and inject secrets to your app
    secrets          πŸ—οΈ Manage your secrets
    secrets list     πŸ“‡ List all the secrets
    secrets get      πŸ” Get a specific secret by key
    secrets create   πŸ’³ Create a new secret
    secrets update   πŸ“ Update an existing secret
    secrets delete   πŸ—‘οΈ Delete a secret
    secrets import   πŸ“© Import secrets from a .env file
    secrets export   πŸ₯‘ Export secrets in a dotenv format
    users            πŸ‘₯ Manage users and accounts
    users whoami     πŸ™‹ See details of the current user
    users logout     πŸƒ Logout from phase-cli
    users keyring    πŸ” Display information about the Phase keyring
    docs             πŸ“– Open the Phase CLI Docs in your browser
    console          πŸ–₯️ Open the Phase Console in your browser
    update           πŸ†™ Update the Phase CLI to the latest version

Features

  • Inject secrets to your application during runtime without any code changes
  • Import your existing .env files and encrypt them
  • Sync encrypted secrets with Phase cloud
  • Multiple environments eg. dev, testing, staging, production

See it in action

asciicast

Installation

You can install Phase-CLI using curl:

curl -fsSL https://get.phase.dev | bash

Usage

Login

Create an app in the Phase Console and copy appID and pss

phase auth

Initialize

Link the phase cli to your project

phase init

Import .env

Import and encrypt existing secrets and environment variables

phase secrets import .env

List / view secrets

phase secrets list --show

Run and inject secrets

phase run // your run command

Example:

phase run yarn dev
phase run go run
phase run npm start

Development:

Make sure virtualenv is installed

pip3 install virtualenv

Create a virtualenv:

virtualenv phase-cli

Switch to the virtualenv:

source phase-cli/bin/activate

Install dependencies:

pip3 install -r requirements.txt
export PYTHONPATH="$PWD"
python3 phase_cli/main.py