Constructor, to be called with the output of WinccoaManager.cfgReadContent.
Configuration data as read by WinccoaManager.cfgReadContent.
Readonly
dataConfiguration data that has been created by reading a config file with WinccoaManager.cfgReadContent. All getter methods of this instance return setting from this object.
Gets the numeric value of a single config setting as stored in data.
Name of the config section.
Name of the setting.
Numeric value of the requested config setting. If section or
setting are not found in data, undefined
is returned.
If setting is contained in data more than once, the
last value is returned.
import { WinccoaConfig, WinccoaManager } from 'winccoa-manager';
const winccoa = new WinccoaManager();
function portNumbers() {
const config = new WinccoaConfig(winccoa.cfgReadContent());
const httpPort = config.getNumber('webClient', 'httpPort');
const httpsPort = config.getNumber('webClient', 'httpsPort');
return [httpPort, httpsPort];
}
Gets the string value of a single config setting as stored in data.
Name of the config section.
Name of the setting.
String value of the requested config setting. If section or
setting are not found in data, undefined
is returned.
If setting is contained in data more than once, the
last value is returned.
import { WinccoaConfig, WinccoaManager } from 'winccoa-manager';
const winccoa = new WinccoaManager();
function langInfo() {
const config = new WinccoaConfig(winccoa.cfgReadContent());
const projLanguage = config.getString('general', 'lang');
const allLanguages = config.getStringArray('general', 'langs');
console.log(`Using ${projLanguage} from [${allLanguages}]`);
}
Gets the string value of a config setting as stored in data
that can occur more than once in a config file (e.g. langs
).
Name of the config section.
Name of the setting.
One or more string values of the requested config setting.
If section or setting are not found in data,
undefined
is returned.
Helper class that simplifies access to data read from config files. To be used together with WinccoaManager.cfgReadContent.