Skip to main content

Custom Configurations

If you want to your own configurations, simply merge your configurations inteface with ConfigList

shared/my-custom-configurations.ts

export type GoogleConfigurations = {    google?: {        apiKey: string;    }}

Note the ? after google keyword, this will make the google object optional to be added to our configuration declaration list.

Now in any of our config files, let's add these new configurations

my-shared/config.ts
import config, { ConfigList } from 'mongez/config';import { GoogleConfigurations } from './my-custom-configurations';
const settings: ConfigList & GoogleConfigurations = {    cache: {        prefix: 'mngz-'    },    google: {        apiKey: 'some-key'    }};
config.set(settings);