ConfigBase

ConfigBase

Base Config Object Supports classes with a single argument "options" These will be sorted into a member called "this.config" containing all the same keys Crucially, these can also be overriden through environment variables For example, for a config option "timeout" for class Database, this could be overriden through either: env.THEMEPARKS_TIMEOUT (using a "global module name") env.DATABASE_TIMEOUT (using the class name) Classes can also add additional prefixes to the supported environment variables through: new ClassInstance({configPrefixes: ['myCustomPrefix']}); Which would also allow env.MYCUSTOMPREFIX_TIMEOUT to be used Note that a default value must be supplied for the environment variable to be processed If the default value is a number, the environment variable will be cast to a number as well

Constructor

new ConfigBase(options)

Description:
  • A base class that can be configured through environment variables
Source:
Parameters:
Name Type Description
options object Config for instantiating this object

Classes

ConfigBase