launchdarkly-labs / project-migrator-script

Migrate Project Information from one account to another
3 stars 7 forks source link

Project Migrator

Requirements

Considerations

Known issues

Things you Should Consider when migrating flags?

Instructions for use

  1. Sourcing data

First, export your source data. The source.ts script writes the data to a newly created source/project/<source-project-key> directory.

Here's how to export your source data:

deno run --allow-env --allow-read --allow-net --allow-write source.ts -p <SOURCE PROJECT KEY> -k <SOURCE LD API KEY>
  1. Migrating data

Then, migrate the source data to the destination project. The migrate.ts script reads the source data out of the previously created source/project/<source-project-key> directory. Then it uses the DESTINATION PROJECT as the project key, and updates the destination project using a series of POSTs and PATCHs.

Here's how to migrate the source data to your destination project:

deno run --allow-env --allow-read --allow-net --allow-write migrate.ts -p <SOURCE PROJECT KEY> -k <DESTINATION LD API KEY> -d <DESTINATION PROJECT KEY>

Important note The script currently doesn't support merging two already existing projects - make sure the destination project doesn't exist before executing the migrate.ts script. If you have already created the destination project manually, delete the project before proceeding.

Resources migrated by the script

Pointing to a different instance

Pass in the -u argument with the domain of the other instance. By default, these scripts apply to your projects on app.launchdarkly.com.