Variable Substitution
The configuration mechanism of PRIS supports basic variable substitution.
Therefore it is possible to add properties to the global.properties
file and reference the property values in any requisition.properties
file.
Properties defined in the global.properties
can be overwritten in a requisition.properties
file.
It is also possible to use properties defined in a requisition.properties
in a different part of the same requisition.properties
again.
An implicit property requisition
is also available in requisition.properties
by default.
The following examples demonstrate the use of properties as variables in a PRIS configuration.
With the following configuration Nodes from the OpenNMS Demo system will be fetched.
To get the information a authentication is required and provided as a global configuration parameter.
The requisition for this example is named opennmsdemo
.
### File: global.properties
# Start web server
# The web server listens for requests and can be accessed on TCP port 8000 of all interfaces
# URL: http://${your-ip}:8000/requisitions/${name-requisition-cfg}
driver = http
host = 0.0.0.0
port = 8000
httpUser = myUser
httpPassword = 987654321
### File: opennmsdemo/requisition.properties
source = http
source.url = http://demo.opennms.com/opennms/rest/requisitions/${requisition}
source.username = ${httpUser}
source.password = ${httpPassword}
### mapper to set asset longitude and latitude based on a surveillance category ###
mapper = script
mapper.file = setGeoInfo.groovy