Tutorial: Bundle Configuration

Bundle Configuration

Bundles can be configured via *.json config files in the cfg directory of NodeCG.


Say we have a bundle named test-bundle. If we create./cfg/test-bundle.json with the following contents:

    "myData": "hello"

... that data can be accessed from via NodeCG#bundleConfig:

console.log(nodecg.bundleConfig.myData); // prints "hello"

JSON Schema

If your bundle has a configschema.json file in its root, NodeCG will validate the config file (if any) for your bundle against this JSON Schema, and will throw errors on startup if the config file fails to pass validation. This is often the most efficient way to enforce a specific structure for your bundle's config.

See Understanding JSON Schema for more information on what a JSON Schema is and how to use one.