Documentation Index
Fetch the complete documentation index at: https://mintlify.com/twpayne/chezmoi/llms.txt
Use this file to discover all available pages before exploring further.
chezmoi includes support for Dashlane, a password manager, using the Dashlane CLI to expose data as template functions.
Setup
Install Dashlane CLI
Install the Dashlane CLI from the Dashlane website.
brew install dashlane/tap/dashlane-cli
Log In
Authenticate with Dashlane:
Follow the prompts to complete authentication.
Template Functions
dashlanePassword
Retrieve password entries matching a filter:
{{ (index (dashlanePassword "filter") 0).password }}
Returns an array of matching password entries.
dashlaneNote
Retrieve secure notes matching a filter:
{{ dashlaneNote "filter" }}
Returns the note content as a string.
Usage Examples
Basic Password Retrieval
# Get password from entry titled "GitHub"
{{ (index (dashlanePassword "GitHub") 0).password }}
Git Configuration
# Store in Dashlane with title "Git Config"
# Fields: username, email, signing_key
{{ $git := index (dashlanePassword "Git Config") 0 -}}
[user]
name = {{ $git.username }}
email = {{ $git.email }}
signingkey = {{ $git.note }}
AWS Credentials
{{ $aws := index (dashlanePassword "AWS") 0 -}}
[default]
aws_access_key_id = {{ $aws.username }}
aws_secret_access_key = {{ $aws.password }}
NPM Configuration
{{ $npm := index (dashlanePassword "NPM") 0 -}}
//registry.npmjs.org/:_authToken={{ $npm.password }}
email={{ $npm.email }}
Database Credentials
~/.config/db/config.yml.tmpl
{{ $db := index (dashlanePassword "Production Database") 0 -}}
production:
host: {{ $db.url }}
username: {{ $db.username }}
password: {{ $db.password }}
port: 5432
database: production_db
Multiple Services
~/.config/api-keys.env.tmpl
# GitHub
{{ $github := index (dashlanePassword "GitHub API") 0 -}}
GITHUB_TOKEN={{ $github.password }}
# GitLab
{{ $gitlab := index (dashlanePassword "GitLab API") 0 -}}
GITLAB_TOKEN={{ $gitlab.password }}
# OpenAI
{{ $openai := index (dashlanePassword "OpenAI") 0 -}}
OPENAI_API_KEY={{ $openai.password }}
SSH Configuration
{{ $github := index (dashlanePassword "GitHub SSH") 0 -}}
{{ $gitlab := index (dashlanePassword "GitLab SSH") 0 -}}
Host github.com
User {{ $github.username }}
IdentityFile ~/.ssh/id_ed25519
Host gitlab.com
User {{ $gitlab.username }}
IdentityFile ~/.ssh/id_rsa
Secure Notes
Store multiline data like SSH keys or certificates in secure notes:
{{ dashlaneNote "SSH Private Key" }}
~/.config/ssl/certificate.pem.tmpl
{{ dashlaneNote "SSL Certificate" }}
Kubernetes Config
{{ $k8s := index (dashlanePassword "Kubernetes") 0 -}}
apiVersion: v1
kind: Config
clusters:
- cluster:
server: {{ $k8s.url }}
certificate-authority-data: {{ dashlaneNote "K8s CA Cert" | b64enc }}
name: production
users:
- name: admin
user:
token: {{ $k8s.password }}
contexts:
- context:
cluster: production
user: admin
name: prod-context
current-context: prod-context
Password Entry Structure
Dashlane password entries typically have these fields:
title: Entry title
username: Username or login
password: Password value
email: Email address
url: Website URL
note: Additional notes
{{ $entry := index (dashlanePassword "Service") 0 -}}
Title: {{ $entry.title }}
Username: {{ $entry.username }}
Password: {{ $entry.password }}
Email: {{ $entry.email }}
URL: {{ $entry.url }}
Note: {{ $entry.note }}
Filtering
The filter argument matches against:
- Entry title
- Domain/URL
- Username
- Email
# Matches title, domain, or any field
{{ dashlanePassword "github" }}
# More specific filter
{{ dashlanePassword "github.com" }}
{{ dashlanePassword "GitHub API" }}
Configuration
Custom Command
If dcli is not in your PATH:
~/.config/chezmoi/chezmoi.toml
[dashlane]
command = "/custom/path/to/dcli"
Complete Examples
Multi-Service Configuration
~/.config/services.yml.tmpl
{{ $github := index (dashlanePassword "GitHub") 0 -}}
{{ $aws := index (dashlanePassword "AWS") 0 -}}
{{ $db := index (dashlanePassword "Database") 0 -}}
github:
username: {{ $github.username }}
token: {{ $github.password }}
email: {{ $github.email }}
aws:
access_key_id: {{ $aws.username }}
secret_access_key: {{ $aws.password }}
region: us-east-1
database:
host: {{ $db.url }}
username: {{ $db.username }}
password: {{ $db.password }}
database: production_db
Docker Registry
~/.docker/config.json.tmpl
{{ $docker := index (dashlanePassword "Docker Hub") 0 -}}
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "{{ printf "%s:%s" $docker.username $docker.password | b64enc }}"
}
}
}
Environment Variables
#!/bin/bash
{{ $github := index (dashlanePassword "GitHub") 0 -}}
{{ $aws := index (dashlanePassword "AWS") 0 -}}
{{ $openai := index (dashlanePassword "OpenAI") 0 -}}
# GitHub
export GITHUB_TOKEN="{{ $github.password }}"
export GH_TOKEN="{{ $github.password }}"
# AWS
export AWS_ACCESS_KEY_ID="{{ $aws.username }}"
export AWS_SECRET_ACCESS_KEY="{{ $aws.password }}"
# OpenAI
export OPENAI_API_KEY="{{ $openai.password }}"
Troubleshooting
Not Logged In
Sync and authenticate:
Entry Not Found
List all password entries:
List all notes:
Command Not Found
Ensure Dashlane CLI is installed:
which dcli
dcli --version
Testing Templates
Test template functions:
chezmoi execute-template '{{ index (dashlanePassword "test") 0 | toJson }}'
chezmoi execute-template '{{ dashlaneNote "test-note" }}'
Multiple Matches
If a filter returns multiple results, access by index:
# First match
{{ (index (dashlanePassword "github") 0).password }}
# Second match
{{ (index (dashlanePassword "github") 1).password }}
Use more specific filters to avoid multiple matches.
Best Practices
- Use descriptive titles: Make entries easy to filter
- Consistent naming: Use a naming convention for entries
- Use notes field: Store additional structured data in notes
- Specific filters: Use precise filters to avoid multiple matches
- Secure notes: Use secure notes for large/multiline data
- Test filters: Verify filters match the right entries
- Stay synced: Run
dcli sync regularly
- Organize: Use Dashlane’s folders/categories for organization
See Also