Use template configuration in flowforge to customize node-red instance

Add template settings

insert image description here

In FlowForge, each project is created from a template. A template defines a set of preconfigured options for a project. This includes runtime settings - more commonly values ​​set in the Node-RED settings.js file.

Templates also define which options the project can customize.

This article explains how to add new Node-RED runtime options to template objects so that developers can customize them for a single instance and pass them to the underlying Node-RED settings.js file.

For simple Boolean/String/Number types, it can be defined directly. For other types (objects/arrays), it becomes a little more complicated, and there are no official examples.

For general cases, you can follow the steps below to set the template:

  • update front end

    • Choose a name for the setting to add it to the list of known settings and any validation logic needed
    • Add this to the appropriate template section
  • update runtime

    • Add this to the list of known settings and any additional validation logic
  • update launcher

    • Update the template used to generate settings.js with the new properties

update front end

There is a set of views in the front end for displaying and editing templates. They are used in two different ways:

When creating/editing a template. All options are available, there is a dropdown that allows users to set policies on settings (controls whether the project is allowed to override settings)
when editing project settings. Displays all options, but allows users to modify only those options that are allowed to be changed by the template policy.
This reuse of views saves

Guess you like

Origin blog.csdn.net/github_35631540/article/details/129397457