Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const localEnvFilePath = context.amplify.pathManager.getLocalEnvFilePath();
const localEnvInfo = context.amplify.readJsonFile(localEnvFilePath);
const storageParams = context.amplify.readJsonFile(parametersFilePath);
this.bucketName = `${storageParams.bucketName}-${localEnvInfo.envName}`;
const route = path.join('/', this.bucketName);
let localDirS3 = this.createLocalStorage(context, `${storageParams.bucketName}`);
try {
addCleanupTask(context, async context => {
await this.stop(context);
});
this.configOverrideManager = ConfigOverrideManager.getInstance(context);
this.storageName = await this.getStorage(context);
const storageConfig = { port, route, localDirS3 };
this.storageSimulator = new AmplifyStorageSimulator(storageConfig);
await this.storageSimulator.start();
console.log('Mock Storage endpoint is running at', this.storageSimulator.url);
await this.generateTestFrontendExports(context);
} catch (e) {
console.error('Failed to start Mock Storage server', e);
}
}