Ops
Basics
Learn the basics of dotenvx-ops in just a few minutes.
- Login
- Project
- Backup
Login
Log in with the cli.
Instal dotenvx-ops.
npm install @dotenvx/dotenvx-ops --save
npx dotenvx-ops help
Then log in, from the cli.
$ dotenvx-ops login
press Enter to open [https://ops.dotenvx.com/login/device] and enter code [D9C1-03BC]... (Y/n)
⠹ waiting on browser authorization
✔ logged in [username] to this device and activated token [dxo_6kjPifI…]
Follow the prompts to connect your device.
This flow generates a dotenvx oauth token, a dxo_*, allowing secure cli access to your dotenvx account.
Next, create your project and set up the .env.x file.
Project
Add
.env.xproject file.
Go to /new/project and create your project.
On the next screen, you'll see a copy of your .env.x file.
Add it to your project's root.
.env.x
# motdotla/your-project/.env.x
DOTENVX_PROJECT_ID=prj_2e7e159e613a82c4744a8b99599cc62d
# 1. Add this .env.x file to your project's root
# 2. Commit it safely to code
# 3. Back up private key(s) with: dotenvx-ops backup
The
DOTENVX_PROJECT_IDuniquely identifies your project and lives inside your.env.xfile.
Next, you are ready to backup your private key(s).
Backup
Back up your private key(s) from
.env.keys.
Encrypt your .env* file (if you haven't already).
Encrypt
$ echo "HELLO=world" > .env
$ dotenvx encrypt
✔ encrypted (.env)
✔ key added to .env.keys (DOTENV_PRIVATE_KEY)
And back up your private key(s) with dotenvx-ops backup.
$ dotenvx-ops backup
✔ backed up [motdotla/your-project]
That's it! Your project's private key(s) have been backed up.