Home Reference Source
import {ConfigBase} from '@alexvv13/tpapi/lib/configBase.js'
public class | source

ConfigBase

Extends:

events~EventEmitter → ConfigBase

Direct Subclass:

Entity

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.TPAPI_TIMEOUT (using a "global module 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 Summary

Public Constructor
public

constructor(options: object)

A base class that can be configured through environment variables

Member Summary

Public Members
public

config: *

Parse the config of a specific park as object

Public Constructors

public constructor(options: object) source

A base class that can be configured through environment variables

Params:

NameTypeAttributeDescription
options object

Config for instantiating this object

Public Members

public config: * source

Parse the config of a specific park as object