# Module: configurator

Contains the functions necessary to set and get configuration settings from the shared data structure.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - executrix/configurator.js, line 1

### Requires

- module:ruleBroker
- module:data
- @haystacks/constants
- path

### Methods

#### (inner) addPluginConfigurationData(pluginName, pluginConfigData) → {boolean}

Merges plugin defined configuration data with the system defined configuration data.

##### Parameters:

Name | Type | Description
--- | --- | ---
`pluginName` | string | The name of the current plugin these configuration settings belong to.
`pluginConfigData` | object | A JSON object that contains all of the configuration settings for the current plugin.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 344

##### Returns:

True or False to indicate if the merge was successful or not.

Type
  boolean

#### (inner) getAmbiguousDataElement(dataSource, possibleDataNamesArray) → {string|integer|boolean|float|object}

Looks for data in a JSON data object, given an array of possible names the data could be saved under. This function helps to ensure that we will get the data, even if the data element is stored under a data name, that could be all lower case, camel case, or all upper case.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataSource` | object | The source data where the data element should be captured from.
`possibleDataNamesArray` | array.<string> | An array of possible names the could be stored under. Ex: ["name","Name","NAME"]

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 392

##### Returns:

Whatever data element that was found that matches one of the input keys.

Type
  string | integer | boolean | float | object

#### (inner) getConfigurationNamespaceObject(configurationNamespace) → {object|boolean}

Navigates the configuration JSON data object tree to find the namespace of configuration settings.

##### Parameters:

Name | Type | Description
--- | --- | ---
`configurationNamespace` | array.<string> | The path in the configuration JSON object where the configuration setting should be set, or returned.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 261

##### Returns:

The object found at the specified namespace address in the configuration data object, or False if nothing was found.

Type
  object | boolean

#### (inner) getConfigurationSetting(configurationNamespace, configurationName) → {string|integer|boolean|double}

Gets a configuration value based on the configuration name.

##### Parameters:

Name | Type | Description
--- | --- | ---
`configurationNamespace` | string | The path in the configuration JSON object where the configuration setting should be found.
`configurationName` | string | The key of the configuration setting.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 103

##### Returns:

The value of whatever was stored in the D[configuration].

Type
  string | integer | boolean | double

#### (inner) getParentConfigurationNamespaceObject(configurationNamespace, optionalFunctionNameAppendix) → {object|boolean}

Navigates the configuration JSON data object tree to find the namespace of the configuration setting, and then determines the parent and returns the entire tree of the configuration data including that parent and all its top level contents.

##### Parameters:

Name | Type | Description
--- | --- | ---
`configurationNamespace` | string | The fully qualified path in the configuration JSON object where the configuration setting should be found.
`optionalFunctionNameAppendix` | string | An optional function name appendix that could potentially be added to the end of the function name. Ex: @ModuleFontBackgroundColor

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 225

##### Returns:

The parent of the object found at the specified namespace address in the configuration data object, or False if nothing was found.

Type
  object | boolean

#### (inner) getPluginConfigurationNamespaceObject(dataStructure, configurationNamespace)

Navigates the input data structure configuration JSON data object tree to fnd the namespace of configuration settings.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataStructure` | object | The input data structure upon which the configuration setting should be set and then returned.
`configurationNamespace` | object | boolean | The object found at the specified namespace address in the input data structure configuration data object, or False if nothing was found.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 306

#### (inner) processConfigurationNameRules(fullyQualifiedName) → {string}

Processes a fully qualified name and extracts the configuration name without the namespace.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fullyQualifiedName` | string | The fully qualified name with the namespace included.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 138

##### Returns:

The name of the configuration setting without the namespace.

Type
  string

#### (inner) processConfigurationNamespaceRules(fullyQualifiedName) → {string}

Processes a fully qualified name and extracts the namespace.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fullyQualifiedName` | string | The fully qualified name with the namespace included.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 159

##### Returns:

The namespace of the configuration setting, without the configuration name.

Type
  string

#### (inner) processConfigurationValueRules(name, value) → {string|boolean|integer|float|object}

Processes a name and value to execute required code and convert string values to actual data objects needed by the configuration system.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | The name of the configuration variable, without the namespace.
`value` | string | The value of the configuration variable.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 191

##### Returns:

A value that is appropriately processed.

Type
  string | boolean | integer | float | object

#### (inner) setConfigurationSetting(configurationNamespace, configurationName, configurationValue) → {void}

Sets a configuration setting on the configuration data structure stored on the D-data structure.

##### Parameters:

Name | Type | Description
--- | --- | ---
`configurationNamespace` | string | The path in the configuration JSON object where the configuration setting should be set. Ex: businessRules.rules.stringParsing.countCamelCaseWords
`configurationName` | string | The key of the configuration setting.
`configurationValue` | string | integer | boolean | double | The value of the configuration setting.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 30

##### Returns:

Type
  void

#### (inner) setPluginConfigurationSetting(dataStructure, configurationNamespace, configurationName, configurationValue) → {object}

Sets a configurat setting on the configruation data structure stored on the input data structure and returned as an object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataStructure` | object | The input data structure upon which the configuration setting should be set and then returned.
`configurationNamespace` | string | The path n the configruation JSON object where the coniguration setting should be set. Ex: businessRules.rules.stringParsing.countCamelCaseWords
`configurationName` | string | The key of the configuration setting.
`configurationValue` | string | integer | boolean | double | The value of the configuration setting.

Author:
  - Seth Hollingsead
Source:
  - executrix/configurator.js, line 56

##### Returns:

The modified input object with the new configuration value added in the appropriate location.

Type
  object