Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static configure(config: RuntimeVendureConfig): RuntimeVendureConfig {
if (isDevModeOptions(this.options) && this.options.mailboxPort !== undefined) {
const route = 'mailbox';
config.middleware.push({
handler: createProxyHandler({ port: this.options.mailboxPort, route, label: 'Dev Mailbox' }),
route,
});
}
return config;
}
static configure(config: RuntimeVendureConfig) {
this.assetStorage = this.createAssetStorageStrategy(this.options);
config.assetOptions.assetPreviewStrategy = new SharpAssetPreviewStrategy({
maxWidth: this.options.previewMaxWidth || 1600,
maxHeight: this.options.previewMaxHeight || 1600,
});
config.assetOptions.assetStorageStrategy = this.assetStorage;
config.middleware.push({
handler: createProxyHandler({ ...this.options, label: 'Asset Server' }),
route: this.options.route,
});
return config;
}
static async configure(config: RuntimeVendureConfig): Promise {
const route = 'admin';
config.middleware.push({
handler: createProxyHandler({
...this.options,
route: 'admin',
label: 'Admin UI',
basePath: this.options.watch ? 'admin' : undefined,
}),
route,
});
if (this.options.watch) {
config.middleware.push({
handler: createProxyHandler({
...this.options,
route: 'sockjs-node',
label: 'Admin UI live reload',
basePath: 'sockjs-node',
}),
route: 'sockjs-node',
});
}
return config;
}