Options
All
  • Public
  • Public/Protected
  • All
Menu

MAGE configuration

Configuration can be required directly before requiring MAGE in cases where you wish to apply your own custom configuration.

const config = require('mage/lib/config');
config.set('some.path.to.config', 1)
config.set(['some', 'other', 'path'], 1)
const mage = require('mage');

// continue with your test code

See: https://mage.github.io/mage/#dynamic-configuration

Hierarchy

  • Config

Index

Methods

get

getSource

  • Find which configuration file a current configuration value comes from.

    Parameters

    Returns string

    The configuration file the value originates from

set

setTopLevelDefault

  • setTopLevelDefault(moduleName: string, sourcePath: string): void
  • Apply a default configuration from a given configuration file to a configuration sub-path.

    This will always be applied prior to loading user-land configuration files.

    Example:

    var moduleName = 'myModule';
    var configAccessPath = 'modules.' + moduleName
    var defaultConfigFilePath = path.join(process.cwd(), 'lib/modules', moduleName, 'config.yaml')
    mage.core.config.setTopLevelDefault(configAccessPath, defaultConfigFilePath);
    

    Parameters

    • moduleName: string
    • sourcePath: string

    Returns void