Skip to main content

ace-migration-helper

What is this repository for?

This package contains logic to migrate your AddonSettings from Atlassian-Connect-Express app into Fuse DynamoDB table. Migration should be run locally.

How to use

This package allows migration to local emulated DynamoDB table, or to Fuse one, which is used for user authentication.

Example

This example will show how to migrate data into production environment from your MongoDb database:

  1. Specify your profile in ~/.aws/credentials e.g. like this:
   [production]
aws_access_key_id =
aws_secret_access_key =
  1. Code example:
import { MigrationClient } from '@appfire/ace-migration-helper';
import AddonSettingsModel from '../models/mongo/AddonSettings';

const AWS_REGION = 'us-east-1'

const getAddonSettingsCallback = async () => {
const addonSettings = await AddonSettingsModel.find({ key: 'clientInfo' });
return addonSettings.map((doc) => doc.val);
};

export const migrateAddonSettings = async () => {
const migrationClient = new MigrationClient({
region: AWS_REGION,
profile: 'production',
});
await migrationClient.migrateToFuse(getAddonSettingsCallback);
};

Emulation

To migrate into emulated table, you need to specify endpoint in configuration passed to constructor of MigrationClient:

import { MigrationClient } from '@appfire/ace-migration-helper';
const migrationClient = new MigrationClient({
region: AWS_REGION,
endpoint: 'http://localhost:8000',
});

Installation

pnpm i @appfire/ace-migration-helper

Who do I talk to?