Config Class

Helper class that manages all configuration settings for an iModel.js application.

The static Config.App is used by many parts of the iModel.js library to retrieve configuration settings.

The initial use of Config.App appends any environment variable that is prefixed with "imjs".

After the initial use of Config.App, all additional updates to the configuration must be performed using App.add or App.merge.

Expanding variables is supported using ${} syntax. If the variable is of type string and contains a ${}, the rest of the configuration variables are searched to populate the place of the variable. i.e. If the variable appName='TestApp', a variable with a value of 'https://${appName}' will be expanded to https://TestApp.

Does not recursively expand variables such as, appName=${appName}.


Name Description
get(varName: string, defaultVal?: boolean | string | number): any Attempts to retrieve a variable, the search is case-insensitive.  
getBoolean(name: string, defaultVal?: false | true): boolean Attempt to get a boolean type variable value.  
getContainer(): any Return clone of the internal property container object.  
getNumber(name: string, defaultVal?: number): number Attempt to get a number type variable value.  
getString(name: string, defaultVal?: string): string Attempt to get a string type variable value.  
getVars(): string[] Return a list of variable names present in the config.  
has(varName: string): boolean Checks, case-insensitive, if a variable exists.  
merge(source: any): void Merges the provided object into the config.  
query(varName: string): any Retrieves a variable if it exists, otherwise returns undefined.  
remove(varName: string): void Remove a variable from the config.  
set(varName: string, value: boolean | string | number): void Set a new property if it does not exist or updates a property to new value.  


Name Type Description
App Accessor StaticReadOnly Config Provide singleton object for application  

Defined in

Last Updated: 23 April, 2020