doppler CLI to expose data through template functions.
Setup
Install Doppler CLI
Log In
Authenticate with Doppler:Setup Project
Configure Doppler for your project:Template Functions
doppler
Retrieve a specific secret by key:
SECRET_NAME: Required, the secret keyproject-name: Optional, defaults to configured projectconfig: Optional, defaults to configured config (environment)
dopplerProjectJson
Get all secrets as structured JSON:
Configuration
Set default project and config in chezmoi:~/.config/chezmoi/chezmoi.toml
Usage Examples
Simple Secrets
Database Configuration
Using dopplerProjectJson
~/.config/app/config.yml.tmpl
Git Configuration
~/.gitconfig.tmpl
AWS Credentials
~/.aws/credentials.tmpl
Multiple API Keys
~/.config/api-keys.env.tmpl
NPM Configuration
~/.npmrc.tmpl
JSON Secrets
Doppler can store JSON data:~/.config/app/config.yml.tmpl
Environment-Specific Secrets
Doppler excels at managing secrets across environments:Setup Multiple Configs
Use in Templates
~/.config/app/config.yml.tmpl
Performance: Caching
chezmoi caches all secrets from a project/config combination:- First call to
dopplerordopplerProjectJsonfetches all secrets - Subsequent calls for the same project/config use the cache
- No additional API calls for multiple secrets from the same config
Complete Examples
Full Application Configuration
~/.config/app/config.yml.tmpl
Kubernetes ConfigMap
~/k8s/configmap.yaml.tmpl
Managing Secrets in Doppler
Set Secrets
List Secrets
Download Secrets
Delete Secrets
Service Tokens
For CI/CD or production servers, use service tokens:Troubleshooting
Not Logged In
Log in to Doppler:Project/Config Not Set
Configure project and config:Secret Not Found
List all secrets:Command Not Found
Ensure Doppler CLI is installed:Testing Templates
Test template functions:Verify Doppler Access
Best Practices
- Use environments: Leverage Doppler’s config system (dev, staging, prod)
- Set defaults: Configure project/config in chezmoi.toml
- Use dopplerProjectJson: More efficient than multiple doppler calls
- Service tokens: Use service tokens for automated deployments
- Name consistently: Use UPPER_SNAKE_CASE for secret names
- Organize projects: Separate projects for different applications
- Access control: Use Doppler’s RBAC for team access
- Secret rotation: Regularly rotate sensitive credentials
- Audit logs: Monitor secret access in Doppler dashboard
- Local development: Use personal config for local dev secrets