_index.md 4.3 KB


title: "Configuration"

weight: 1

Configuration

All configuration and customization of Vendure is done via the VendureConfig object which gets passed to the bootstrap function:

Example configuration

bootstrap({
    defaultChannelToken: 'default-channel',
    authOptions: {
        sessionSecret: 'xup1hki5zo',
    },
    port: 3000,
    apiPath: 'api',
    dbConnectionOptions: {
        type: 'mysql',
        database: 'vendure-dev',
        host: '192.168.99.100',
        port: 3306,
        username: 'root',
        password: '',
    },
    paymentOptions: {
        paymentMethodHandlers: [examplePaymentHandler],
    },
    customFields: {},
    importExportOptions: {
        importAssetsDir: path.join(__dirname, 'vendure/import-assets'),
    },
    plugins: [
        new DefaultAssetServerPlugin({
            route: 'assets',
            assetUploadDir: path.join(__dirname, 'vendure/assets'),
            port: 4000,
        }),
        new DefaultEmailPlugin({
            templatePath: path.join(__dirname, 'vendure/email/templates'),
            devMode: true,
        }),
        new DefaultSearchPlugin(),
    ],
}).catch(err => {
    console.log(err);
});

The VendureConfig interface

All possible configuration options are defined by the VendureConfig interface.

{{% alert %}} Note on terminology: many of the configuration properties are named "Strategy" - this is because their use follows the Strategy Pattern of software design. {{% /alert %}}

apiPath

The path to the GraphQL API.

assetOptions

Configuration for the handling of Assets (images and other files). See assetOptions.

authOptions

Configuration for authorization and authentication. See authOptions.

channelTokenKey

The name of the property which contains the token of the active channel. This property can be included either in the request header or as a query string.

cors

Set the CORS handling for the server. See the Express cors docs

customFields

Defines custom fields which can be used to extend the built-in entities. See customFields.

dbConnectionOptions

The connection options used by TypeORM to connect to the database. See the TypeORM connection options docs.

defaultChannelToken

The token for the default channel. If not specified, a token will be randomly generated.

defaultLanguageCode

The default ISO 639-1 language code of the server.

emailOptions

Configures the handling of transactional emails. See emailOptions.

entityIdStrategy

Defines the strategy used for both storing the primary keys of entities in the database, and the encoding & decoding of those ids when exposing entities via the API. The default uses a simple auto-increment integer strategy.

hostname

Set the hostname of the server.

importExportOptions

Configuration settings for data import and export.

orderMergeOptions

Define the strategies governing how Orders are merged when an existing Customer signs in.

orderProcessOptions

Defines custom states in the order process finite state machine. See orderProcessOptions.

middleware

Defines custom Express middleware to use for incoming API requests.

paymentOptions

Configures available payment processing methods. See paymentOptions.

plugins

Configure the active Vendure plugins. See plugins.

port

Which port the Vendure server should listen on.

promotionOptions

Configures the Conditions and Actions available when creating Promotions. See promotionOptions.

shippingOptions

Configures the available checkers and calculators for ShippingMethods. See shippingOptions.

silent

When set to true, no application logging will be output to the console.

taxOptions

Configures how taxes are calculated on products. See taxOptions.