check strapi exists before running restore

This commit is contained in:
Bassel 2022-12-07 11:41:12 +02:00
parent db8dac601f
commit 7a9a1d27ba

View File

@ -96,13 +96,13 @@ class LocalStrapiDestinationProvider implements IDestinationProvider {
if (!this.strapi) { if (!this.strapi) {
throw new Error('Not able to stream Configurations. Strapi instance not found'); throw new Error('Not able to stream Configurations. Strapi instance not found');
} }
const strapi = this.strapi;
return new Writable({ return new Writable({
objectMode: true, objectMode: true,
write: async (config: IConfiguration, _encoding, callback) => { write: async (config: IConfiguration, _encoding, callback) => {
try { try {
if (this.options.strategy === 'restore') { if (this.options.strategy === 'restore' && this.strapi) {
await restoreConfigs(strapi, config); await restoreConfigs(this.strapi, config);
} }
callback(); callback();
} catch (error) { } catch (error) {