The new Doppler CLI is exceptionally light and fast, and is provided as a binary to support environments without
Migrate today by visiting our installation documentation.
Doppler Node.js Library
The Doppler CLI provides convenient access to the Doppler API from applications written for only server-side code.
Install the CLI with:
npm install -g @dopplerhq/cli
Here is a list of commands the Doppler CLI offers:
Usage: doppler [options] [command]Options:-V, --version output the version number-k, --key <API KEY> override the API Key in configs--api-host <HOST URL> override Doppler's API host (default: "")--deploy-host <HOST URL> override Doppler's Deploy host (default: "")-h, --help output usage informationCommands:login login into Doppler on your computersetup [options] setup local development for a pipelineconfig view config variablesrun [options] <COMMAND> run your app with variables from Dopplerworkplace [options] workplace informationlogs [options] workplace activity logspipelines [options] list of pipelinesstages [options] list of a pipelines's stagesenvironments [options] list of environments in pipelinevariables [options] view all variables in environmentupdate update the Doppler cli
The first thing you will want to do is login into the CLI in the root directory of your project.
doppler config:set key=<DOPPLER API KEY>
Now let's setup your project's directory to use Doppler. Please make sure you are in the root directory of the project.
Using the CLI to fetch environment variables in production is super easy! Let's set your Doppler credentials so your machine can communicate with Doppler.
doppler config:set key=<DOPPLER API KEY> pipeline=<PIPELINE ID> environment=<ENVIRONMENT NAME>
run command, specify the application you'd like to execute. The application will then be
executed with your Doppler secrets injected directly into the environment. This allows the application
to read your keys out of the environment using your language's built-in environment variable syntax
System.getenv("VAR_NAME"), etc). This method
does not require any changes to your existing application and works with all languages and platforms.
doppler run -- node server.jsOptions:-f, --fallback <DOTENV FILEPATH> writes to this file on boot and read from it when you lose connection to the Doppler API.--fr, --fallback-readonly treat the fallback file as read-only-p, --pipeline <id> pipeline id-e, --environment <name> environment name-- interpret everything after this option as part of the command to run-h, --help output usage information
When the fallback option is enabled, the CLI will write to a
.env file on boot and read from it when you lose connection to the Doppler API.
doppler run --fallback="./fallback.env" -- python server.py
A few ways to use the CLI with popular programming languages:
doppler run -- go run server.go # godoppler run -- php artisan serve # phpdoppler run -- java -jar Server.jar # javadoppler run -- node server.js # node.jsdoppler run -- python server.py # pythondoppler run -- ruby server.rb # ruby