Skip to main content

QConfiguration

@quik/core


@quik/core / QConfiguration

Class: QConfiguration

Defined in: configuration/QConfiguration.ts:29

QConfiguration class, used to fetch (and configure) configuration parameters that can be used to enable/disable or setup various functionalities of the application.

Constructors

Constructor

new QConfiguration(): QConfiguration

Defined in: configuration/QConfiguration.ts:38

Constructor of the configuration class.

Returns

QConfiguration

Properties

_config

protected _config: IQConfigurationObject = {}

Defined in: configuration/QConfiguration.ts:33

The internal configuration.

Methods

all()

all(): IQConfigurationObject

Defined in: configuration/QConfiguration.ts:152

Returns all the configuration properties.

Returns

IQConfigurationObject


array()

array<T>(key, defaultValue?): T[]

Defined in: configuration/QConfiguration.ts:141

Returns the array value of the given configuration key.

Type Parameters

T

T = string

Parameters

key

string

The configuration key.

defaultValue?

any = null

The default value if the configuration key doesn't exist.

Returns

T[]


boolean()

boolean(key): boolean

Defined in: configuration/QConfiguration.ts:188

Returns the boolean value of the given configuration key.

Parameters

key

string

The configuration key.

Returns

boolean


clear()

clear(): void

Defined in: configuration/QConfiguration.ts:45

Clears the internal configuration store.

Returns

void


defaults()

defaults(): IQConfigurationObject

Defined in: configuration/QConfiguration.ts:159

Returns the current default configuration snapshot.

Returns

IQConfigurationObject


get()

get<T>(key, defaultValue?): T

Defined in: configuration/QConfiguration.ts:97

Returns the string value of the given configuration key.

Type Parameters

T

T = string

Parameters

key

string

The configuration key.

defaultValue?

any = null

The default value if the configuration key doesn't exist.

Returns

T


init()

init(configFolder?, useExistingAsDefault?): Promise<void>

Defined in: configuration/QConfiguration.ts:55

Initializes the configuration object with values from the configuration folder.

Parameters

configFolder?

string = "./config"

The folder containing the configuration files.

useExistingAsDefault?

boolean = false

Flag to use existing values as defaults.

Returns

Promise<void>


load()

load(configStore): void

Defined in: configuration/QConfiguration.ts:86

Loads configuration items into our application.

Parameters

configStore

IQConfigurationObject

The configuration store that we want to merge into the local config.

Returns

void


number()

number(key, defaultValue?): number

Defined in: configuration/QConfiguration.ts:179

Returns the numeric value of the given configuration key.

Parameters

key

string

The configuration key.

defaultValue?

number = 0

The default value if the configuration key doesn't exist.

Returns

number


object()

object<Value>(key, defaultValue?): Record<string, Value>

Defined in: configuration/QConfiguration.ts:127

Returns the object value of the given configuration key.

Type Parameters

Value

Value = any

Parameters

key

string

The configuration key.

defaultValue?

any = null

The default value if the configuration key doesn't exist.

Returns

Record<string, Value>


set()

set<T>(key, value): void

Defined in: configuration/QConfiguration.ts:105

Type Parameters

T

T = string

Parameters

key

string

value

T

Returns

void


string()

string(key, defaultValue?): string

Defined in: configuration/QConfiguration.ts:169

Returns the string value of the given configuration key.

Parameters

key

string

The configuration key.

defaultValue?

string = ""

The default value if the configuration key doesn't exist.

Returns

string


url()

url(field, defaultValue?): string

Defined in: configuration/QConfiguration.ts:198

Returns a valid URL value of the given configuration key.

Parameters

field

string

The name of the field.

defaultValue?

string = ""

The default value if the variable doesn't exist.

Returns

string