DPDK Architecture  ->  Bootstrap (v3.0.5)

Config
>= 1.3.4

Application Config
>= 1.34.1

Some default application config is already for you defined and can be overridden in your config/default.json or config/config.json:

const dev = process.env.NODE_ENV !== 'production';

const baseConfig = {
  application: {
    env: dev ? ' (local)' : '',
    basePath: '/',
    host: '0.0.0.0',
    port: 3000,
    version: '_DPDK_VERSION_',
    gtm: '',
    dpdkHeaders: true,
    assetUrl: '',
    graphql: {
      endpoint: "/api"
    },
    dev
  }
};

Config Order
>= v1.3.6

There are multiple config files available for you to use. These are merged in the following order and have a particular role:

baseConfig.js <-- Default config provided by the Bootstrap.
default.json  <-- Lives inside a project and is checked into GIT. This config is therefore available on all environments.
config.json   <-- Lives inside a project and is not checked into GIT. The config is therefore environment specific.

Frontend Config
>= v1.3.4

One part of the config is exposed to the frontend and can be requested like this:

import getConfig from 'next/config';
const { publicRuntimeConfig } = getConfig();

This can be used for feature toggles and frontend specific tokens like Google Tag Manager.

Dynamic Config
>= v1.3.4

Sometimes you need to add dynamic content to the config.
An example would be to add routes to the sitemap from MongoDB.
You can always access the config from the bootstrap an add/update config parts.

const NextBootstrap = require('@dpdk/bootstrap');
const bootstrap = new NextBootstrap(__dirname, process.cwd(), nextConfig);

bootstrap.config.dynamicParam = "Hi!";

bootstrap.init();
Last modifiedFriday, April 30, 2021, 12:00:21 PM UTC
Last authorColin van Eenige
Commit ID4c7a701