Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async startDynamoDBLocalServer(context) {
const { projectPath } = context.amplify.getEnvInfo();
const dbPath = path.join(await getMockDataDirectory(context), 'dynamodb');
fs.ensureDirSync(dbPath);
this.ddbEmulator = await dynamoEmulator.launch({
dbPath,
port: null,
});
return dynamoEmulator.getClient(this.ddbEmulator);
}
export async function launchDDBLocal() {
let dbPath;
while (true) {
dbPath = path.join('/tmp', `amplify-cli-emulator-dynamodb-${v4()}`);
if (!fs.existsSync(dbPath)) break;
}
fs.ensureDirSync(dbPath);
const emulator = await dynamoEmulator.launch({
dbPath,
port: null,
});
const client = await dynamoEmulator.getClient(emulator);
logDebug(dbPath);
return { emulator, dbPath, client };
}
private async startDynamoDBLocalServer(context) {
const { projectPath } = context.amplify.getEnvInfo();
const dbPath = path.join(await getMockDataDirectory(context), 'dynamodb');
fs.ensureDirSync(dbPath);
this.ddbEmulator = await dynamoEmulator.launch({
dbPath,
port: null,
});
return dynamoEmulator.getClient(this.ddbEmulator);
}
export async function launchDDBLocal() {
let dbPath;
while (true) {
dbPath = path.join('/tmp', `amplify-cli-emulator-dynamodb-${v4()}`);
if (!fs.existsSync(dbPath)) break;
}
fs.ensureDirSync(dbPath);
const emulator = await dynamoEmulator.launch({
dbPath,
port: null,
});
const client = await dynamoEmulator.getClient(emulator);
logDebug(dbPath);
return { emulator, dbPath, client };
}