Current situation
Currently, there are two methods of providing object definitions to the configuration system
This type is intended to act as a pass through for other libraries. The usage is intended to be a bit sloppy, preferably referencing where to find the correct definition in the description.
Example usage in MQTT: https://github.com/zoe-codez/digital-alchemy/blob/main/libs/mqtt/src/modules/mqtt.module.ts#L15
Example config ini form
[libs.mqtt.CLIENT_OPTIONS]
host=192.168.1.100
This type is intended to create simple key/value pairs. Both sides should be a string for this.
Example usage in ini form
[application.PICO_MAPPINGS]
2=sensor.office_pico
8=sensor.games_pico
9=sensor.loft_pico
10=sensor.bedroom_pico
11=sensor.bed_pico
12=sensor.living_pico
13=sensor.office_pico_2
14=sensor.office_pico_1
New object type
The object
type is intended to allow a more free form object definition inside the configuration system. Validation can optionally be done against the value, preventing the app from booting + printing errors. Validation is performed once at boot, with one of the following mechanisms.
no validation mechanism
Configuration will ensure the value is an object. Beyond that, it doesn't care.
- if null/undefined: use blank object
- if boolean/number/string: fatal error
json schema
Value will be checked with AJV at boot.
A properly annotated class can be provided to check against the value.
Investigate: can class-transformer do anything productive here?
Extra notes
Data merging
By default, the configuration system should replace the entire object every time it finds one from a higher priority source. The configuration definition should provide an optional boolean flag that will tell the configuration system to merge objects together instead of replacing.