How do I duplicate or migrate secrets between configs?
Although this is not something that is built into our product yet, you can achieve this using the Doppler CLI, the bash shell, and jq
.
It works by taking the output of the raw secret values from one config (so references are captured correctly) and uses bash process substitution to supply the output as a file to the doppler secrets upload
command.
For example, if you wanted to migrate the secrets from dev
to stg
:
PROJECT="your-app-name"
FROM_CONFIG="dev"
TO_CONFIG="stg"
doppler secrets upload --project "$PROJECT" --config "$TO_CONFIG" --raw \
<(doppler secrets --project "$PROJECT" --config "$FROM_CONFIG" --json --raw | jq 'del(.DOPPLER_PROJECT, .DOPPLER_ENVIRONMENT, .DOPPLER_CONFIG) | to_entries | map({(.key): (.value | .raw )}) | add')
Updated over 2 years ago