/** @packageDocumentation * @module Configuration */ /** * @public * @deprecated Previously only used by the Config */ export declare type ValueType = string | boolean | number; /** 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]] gathers configuration variables from 3 different locations: * 1. Sets 'imjs_env_is_browser' based on if the window is defined. * 1. Performs a GET request for a "config.json". If found merges the files contents into the Config. * 1. Appends any environment variable that are prefixed with "imjs". * * > The order listed above is important because if there is any overlap, the last one to contain the variable will win. * * After the initial use of `Config.App`, all additional updates to the configuration must be performed using [[Config.App.add]] or [[Config.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}`. * * @public */ export declare class Config { private static _appConfig; private _container; private _expanded; private constructor(); /** Sets up the Config object by performing 3 steps, this order: * 1. Sets 'imjs_env_is_browser' based on if the window is defined. * 1. Performs a GET request for a "config.json". If found merges the entire file. * 1. Appends environment variables that are prefixed with "imjs". */ private appendSystemVars; /** Performs a case insensitive search for the variable name. * If the variable exists, return the variable in the casing its currently stored. * Otherwise, return the original name provided. */ private checkExists; /** Expand variable containing other variables as values. * Nested variables are wrapped with ${}. * i.e. ${test1}_${test2} * ${test1}${test2} * This is strict function that will fail if recursion is detected or var name is not found. */ private expand; /** Checks, case-insensitive, if a variable exists. */ has(varName: string): boolean; /** Attempts to retrieve a variable, the search is case-insensitive. * @param varName The name of the config variable to find * @param defaultVal The default value to return if the variable does not exist. If undefined, an exception is thrown. * @throws if the variable does not exist and a default value is not provided. */ get(varName: string, defaultVal?: boolean | string | number): any; /** Retrieves a variable if it exists, otherwise returns undefined. */ query(varName: string): any; /** Attempt to get a number type variable value. * @param name the variable name to retrieve. * @param defaultVal the value to return if the variable does not exist. * @throws if the variable does not exist and a default value is not provided. */ getNumber(name: string, defaultVal?: number): number; /** Attempt to get a boolean type variable value. * @param name the variable name to retrieve. * @param defaultVal the value to return if the variable does not exist. * @throws if the variable does not exist and a default value is not provided. */ getBoolean(name: string, defaultVal?: boolean): boolean; /** Attempt to get a string type variable value. * @param name the variable name to retrieve. * @param defaultVal the value to return if the variable does not exist. * @throws if the variable does not exist and a default value is not provided. */ getString(name: string, defaultVal?: string): string; /** Remove a variable from the config. * @throws if the variable does not exist. */ remove(varName: string): void; /** Set a new property if it does not exist or updates a property to new value. */ set(varName: string, value: boolean | string | number): void; /** Return a list of variable names present in the config. */ getVars(): string[]; /** Merges the provided object into the config. * @note Overrides existing variables if already exist. Immutable properties are skipped. * @throws if the provided `source` is not of type object. */ merge(source: any): void; /** Copies the properties, recursing into object properties. Only do the translateVar at the top level. */ private _copyProperties; /** Return clone of the internal property container object. */ getContainer(): any; /** Provide singleton object for application */ static get App(): Config; } //# sourceMappingURL=Config.d.ts.map