AssetServerOptions
AssetServerOptions
The configuration options for the AssetServerPlugin.
Signature
interface AssetServerOptions {
hostname?: string;
port: number;
route: string;
assetUploadDir: string;
assetUrlPrefix?: string;
previewMaxWidth?: number;
previewMaxHeight?: number;
presets?: ImageTransformPreset[];
namingStrategy?: AssetNamingStrategy;
storageStrategyFactory?: (
options: AssetServerOptions,
) => AssetStorageStrategy | Promise<AssetStorageStrategy>;
}
Members
hostname
property
type:
string
port
property
type:
number
The local port that the server will run on. Note that the AssetServerPlugin
includes a proxy server which allows the asset server to be accessed on the same
port as the main Vendure server.
route
property
type:
string
The proxy route to the asset server.
assetUploadDir
property
type:
string
The local directory to which assets will be uploaded when using the LocalAssetStorageStrategy.
assetUrlPrefix
property
type:
string
The complete URL prefix of the asset files. For example, “https://demo.vendure.io/assets/"
If not provided, the plugin will attempt to guess based off the incoming request and the configured route. However, in all but the simplest cases, this guess may not yield correct results.
previewMaxWidth
property
type:
number
default:
1600
The max width in pixels of a generated preview image.
previewMaxHeight
property
type:
number
default:
1600
The max height in pixels of a generated preview image.
presets
property
type:
ImageTransformPreset[]
An array of additional ImageTransformPreset objects.
namingStrategy
Defines how asset files and preview images are named before being saved.
storageStrategyFactory
property
type:
( options: AssetServerOptions, ) => AssetStorageStrategy | Promise<AssetStorageStrategy>
default:
() => LocalAssetStorageStrategy
A function which can be used to configure an AssetStorageStrategy. This is useful e.g. if you wish to store your assets
using a cloud storage provider. By default, the LocalAssetStorageStrategy is used.