Parameters
The parameters section is an optional component of service commissioning files that enables service customization for different use cases. When installing or reconfiguring a service, users will be prompted to either input custom values for these parameters or confirm their default values.
Using Parameter Values
Parameter values can be utilized within the service commissioning file by reference (!ref
) or by string substitution (!sub
).
Reference Method (!ref
)
!ref
)Use the reference method to directly insert a parameter's value at a specific property location. The syntax consists of !ref
followed by the parameter name.
Example
String Substitution Method (!sub
)
!sub
)Use string substitution to replace the parameter name inside the a string by the parameter’s value. The resulting string with the substituted value will be used at the specified property location. The syntax uses !sub
followed by a string containing the parameter name enclosed in ${...}
.
Example
Parameter Properties
The parameters section of a service commissioning file allows you to define configurable values using specific properties for each parameter. These properties follow the JSON Schema specification, which provides a robust framework for defining and validating parameter data types and constraints.
The following properties can be specified for each parameter:
Core Properties
type
Required. The data type for the parameter (DataType), specified by one of the following strings.
boolean
: true/false values. When referenced with!ref
within service commissioning files, it will evaluate to true/false.
default
Optional. A value of the appropriate type for the parameter to use if no value is specified when the service is installed. If additional constraints have been defined as explained below, this default value must adhere to those constraints.
description
Optional. A string of up to 4000 characters that describes the parameter. This is shown in the configuration dialog window when installing a service in the admin UI.
enum
Optional. An array containing the list of values allowed for the parameter. If a value different from all array elements has been specified for this parameter, it will be invalid, and the resulting error message will list the allowed values as given in this property as allowedValues: [...]
String-Specific Properties
minLength
Optional, and only active for string values: An integer value that specifies the minimum number of characters which the value must have.
maxLength
Optional, and only active for string values: An integer value that specifies the maximum number of characters which the value must have.
pattern
Optional, and only active for string values: A regular expression pattern which the value must match, otherwise the value is invalid.
format
Number-Specific Properties
minimum
Optional, and only active for number values: The minimum allowed value for the data to be valid.
maximum
Optional, and only active for number values: The maximum allowed value for the data to be valid.
Array-Specific Properties
items
Required. An object, or an array of objects, describing the types of the array’s items. To define an array of strings, write items: { type: string }
minItems
Optional. The value should be a number defining the minimum number of items in the array. Only applicable if items
is an object and not an array, i.e. all array elements have the same type.
maxItems
Optional. The value should be a number defining the maximum number of items in the array. Only applicable if items
is an object and not an array, i.e. all array elements have the same type.
uniqueItems
Optional. If the value is true
, the array should have unique items only to be valid.
Example
Global Pre-Defined Parameters
In addition to the parameters defined in the parameters section of the service commissioning file, the following global parameters are always pre-defined by Connectware and can be used everywhere:
Cybus::ServiceId
Cybus::MqttHost
Hostname of the Connectware’s internal MQTT broker
Cybus::MqttPort
Hostname of the Connectware’s internal MQTT Broker
Cybus::MqttUser
Valid username for the Connectware’s internal MQTT broker (auto-generated)
Cybus::MqttPassword
Valid password for the Connectware’s internal MQTT broker (auto-generated)
Cybus::MqttRoot
Resource Isolation and Namespacing
Connectware implements resource isolation between services through a systematic namespacing approach. This ensures that resources from different services remain protected and separated from each other.
The namespacing principle automatically applies unique prefixes to all resource identifiers that could potentially conflict across services. This isolation extends to multiple aspects including:
Generated URLs
Persistent storage
MQTT communication topics
Docker container names
MQTT Namespacing
For MQTT communication, Connectware automatically prepends all service-specific topics with a unique prefix based on the service instance. This prefix is available within the commissioning file through the global parameter Cybus::MqttRoot
.
Custom Prefix Configuration
While automatic namespacing works well for most cases, some applications may require custom prefix configurations. This typically occurs when working with Docker containers that have fixed MQTT topic requirements that cannot be easily configured through environment variables.
In such cases, you can manually define the Cybus::MqttRoot
prefix by setting the CYBUS_MQTT_ROOT
variable in the service commissioning file's definitions section:
When manually setting the MQTT root prefix:
You become responsible for preventing naming collisions between service instances
Ensure your prefix choice doesn't conflict with other services running on the same Connectware installation
Consider this approach only when automatic namespacing cannot meet your application's requirements
This manual configuration should be used sparingly, as the automatic namespacing feature provides built-in protection against resource conflicts.
Last updated
Was this helpful?