It makes it easier to use Doppler without setup in serverless.
First, install the package by entering the following command.
npm install -D serverless-doppler
Then, add the line below to serverless.yml.
plugins:
- serverless-doppler
If you already have a project setting with the Doppler CLI, it is automatically called, so you do not need to set anything.
Congratulations. Automatically specifies the environment variable at run time.
⚠️ In an deployed environment (ex: lambda), the environment variable is not automatically updated. You must manually deploy it manually when updating.
Successful console log:
Loaded Doppler settings. (project: <PROJECT NAME>, config: <CONFIG>)
Loading environment variables from Doppler...
The environment variables below are applied.
- DOPPLER_PROJECT
- DOPPLER_ENVIRONMENT
- DOPPLER_CONFIG
You can add the following options:
Config | Description | Default |
---|---|---|
project | Doppler project name | Doppler calls automatically via CLI |
token | Doppler token | Doppler calls automatically via CLI |
config | Doppler config | Same as serverless stage ${sls:stage} |
custom:
doppler:
project: <DOPPLER PROJECT>
config: <DOPPLER CONFIG>
token: <DOPPLER TOKEN>