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.

npm install node-red-contrib-config-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-list to find the config files.
  • It uses lodash.merge() to merge the defaultConfig with the contents of the files found.

Node Info

Version: 0.1.0
Updated 2 days ago
License: Apache-2.0
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Keywords

  • node-red
  • config-files
  • config
  • json

Maintainers