Show Table of Contents
6.2. Default Locations for Script Module Sources
The require statement loads a modules from an identified location to be used in a script. The JBoss ON CLI, CLI script, or server-side script can load a module from any of several locations, for both the local and remote sources.
The require line has the format sourceType:/path/moduleFile.
The default module locations are defined in the following list.
- Modules Directory
- Description — Loads the specified module file from a configured location on the local system. The CLI has a system property (
RHQ_CLI_MODULES_DIR) which defines a default directory for modules.The location can be set or changed by updating therhq-cli-env.shfile or by setting it at the command line, as shown in the examples below:RHQ_CLI_MODULES_DIR=/opt/rhq/modules
RHQ_CLI_MODULES_DIR=/opt/rhq/modules; bin/rhq-cli.sh
Available For — CLI - Local Filesystem
- Loads the specified module file from an absolute path on the local system.Format — file:/pathExample:
var myModule = require("file:/opt/jon/js-modules/myModule"); //This will load the module from a file called "myModule.js" in the /opt/jon/js-modules directory on the local filesystem.Available For — CLI - JBoss ON Repository
- Downloads the specified module file from the given JBoss ON repository. Because this connects to the server, a user must be logged into the JBoss ON server first.Format — rhq://repositories/repo_name/module_nameExample:
var myModule = require("rhq://repositories/myRepo/myModule"); //This will load the module stored in the RHQ server repository "myRepo" called "myModule.js"Available for — CLI, Server - JBoss ON Downloads
- Downloads the specified module file from the downloads location on the JBoss ON server. JBoss ON could make some scripts available that can be used for alert server-side scripts or for the CLI. Because this connects to the server, a user must be logged into the JBoss ON server first.Format — rhq://downloads/path/module_nameExample:
var myModule = require("rhq://downloads/script-modules/util"); //This will load the module stored in the RHQ server downloads section called "js/util.js"Available For — CLI, Server

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.