Load secrets into environment variables
The Dashlane CLI allows you to load secrets into environment variables. This is useful for example when you want to use secrets in your applications in development.
By using secret references in your environment variables, you can load secrets from your Dashlane account into your environment variables and avoid having to store them in plain text in your code.
Get your secret reference
Follow the guide in Read secrets references to learn how to get your secret reference.
It should look like this: dl://<secret_identifier>/<field>?<transformer>
Export environment variables
You can now export your secret reference into an environment variable :
export GITLAB_TOKEN='dl://mygitlabtoken/password'
Use your secret in your application
In your code you can for instance read the variable from the env:
const token = process.env.GITLAB_TOKEN;
console.log(token);
Finally, you can use the dcli exec
command to run your application with the environment variables loaded from your Dashlane account.
dcli exec -- node app.js
The stdin and stdout of your application will be piped to the terminal.
Every environment variable that starts with dl://
will be replaced by the secret value from your Dashlane account.