DOTENV_PRIVATE_KEY=key dotenvx run
Decrypt your encrypted `.env` by setting `DOTENV_PRIVATE_KEY` before dotenvx run.
$ touch .env
dotenvx set HELLO encrypted
echo "console.log('Hello ' + process.env.HELLO)" > index.js
# check your .env.keys files for your privateKey
DOTENV_PRIVATE_KEY="122...0b8" dotenvx run -- node index.js
⟐ injected env (2) from .env
Hello encrypted
You can also load this value from 1Password with op read.
DOTENV_PRIVATE_KEY="$(op read op://Engineering/my-app/DOTENV_PRIVATE_KEY)" dotenvx run -- node index.js
See Use dotenvx with 1Password.
Or load it from Bitwarden with bw get password.
export BW_SESSION="$(bw unlock --raw)"
DOTENV_PRIVATE_KEY="$(bw get password DOTENV_PRIVATE_KEY)" dotenvx run -- node index.js