node-red-contrib-config-files 0.1.0
Read and merge configuration files (JSON). The files are sorted by their file names and merged in this order. The “defaultConfig” property can be used to define configuration values that are missing in the files.
node-red-contrib-config-files
Node-Red node for reading and merging configuration files with JSON content. The output returns the resulting configuration.
Directory and search patterns for configuration files can be configured using the node properties and/or with the input message.
The files are sorted by their file names and merged in this order. The defaultConfig property can be used to define configuration values that are missing in the files.
If no configuration files are found, the defaultConfig is returned.
The node status displays one of the following two messages:
- Found {count} config files in '{configDir}' with pattern '{configFilePattern}'
- No config files found in '{configDir}' with pattern '{configFilePattern}' -> using default config
Internals
- This custom node is created from a subflow.
- It uses
node-red-contrib-filesystem : fs-listto find the config files. - It uses
lodash.merge()to merge thedefaultConfigwith the contents of the files found.