How can you duplicate an Project Environment

I’m sure I am missing something, but how can I duplicate a Project Environment? There is an option to create a new Environment, but that only creates empty secret pairs.

Currently, I am having to consider making a change to 50 odd secrets, saving them and then removing the changes so that I can save them again as correct values.

Doing something like exporting all the values and then importing them is not an option as all the variable substitution is processed during exporting step.

Sadly the compare feature does not help as it only provides the comparison of 2 Environments, rather than any way to copy between Environments. On a side note compare currently calls Environments configs and so does not follow the terms used across the documentation.

Thanks in advance

Roger

Hi rit001,

Although this is not something that is built into our product yet, you can achieve this using the Doppler CLI, bash, 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 dev to stg:

PROJECT="your-app-name"
FROM_ENV="dev"
TO_ENV="stg"

doppler secrets upload --project "$PROJECT" --config "$TO_ENV" --raw \
  <(doppler secrets --project "$PROJECT" --config "$FROM_ENV" --json --raw | jq 'del(.DOPPLER_PROJECT, .DOPPLER_ENVIRONMENT, .DOPPLER_CONFIG) | to_entries | map({(.key): (.value | .raw  )}) | add')

Thanks, as a workaround it should do the job, but please add the feature to the wish/request list for the GUI.

Roger