Setting the Consul Connection Parameters
You set the values for app properties that you want to override by creating a Key/Value pair for each property in Consul. You can create a standalone property or a hierarchy that groups multiple related properties.
To create a standalone property (without hierarchy), you simply enter the property name as the name of the Key when creating the Key in Consul. When you create a property within a hierarchy, enter the hierarchy in the following format in the
Create Key field in Consul:
<key_prefix>/<key_name>
where
<key_prefix>
is a meaningful string or hierarchy that serves as a path to the key in Consul and
<key_name>
is the name of the app property whose value you want to override.
For example, in
dev/Timer/Message
and
test/Timer/Message
,
dev/Timer
and
test/Timer
are the
<key_prefix>
which could stand for the dev and test environments and
Message
is the key name. During runtime, you provide the
<key_prefix>
value that tells your app the location in Consul from where to access the property values.
-
The Key name in Consul must be identical to its counterpart on the Environmental Controls tab on the Data Plane. If the key name does not match exactly, a warning message is displayed, and the app uses the default value that you configured for the property in Flogo.
-
A single app property, for example,
Message
, is looked up by your app as eitherMessage
or<key_prefix>/Message
in Consul. An app property within a hierarchy such asx.y.z
is looked up asx/y/z
or<key_prefix>/x/y/z
in Consul. Note that the dot in the hierarchy is represented by a forward slash (/) in Consul.
After you have configured the app properties in Consul, you need to set the environment variable,
FLOGO_APP_PROPS_CONSUL
, with the Consul connection parameters for your app to connect to the Consul. When you set the environment variable, it triggers the app to run, which connects to the Consul using the Consul connection parameters you provided and pulls the app property values from the
key_prefix
location you set by matching the app property name with the
key_name
. Hence, the Key names must be identical to the app property names defined on the Environmental Controls tab on the Data Plane.
You can set the
FLOGO_APP_PROPS_CONSUL
environment variable by directly entering the values as a JSON string. Add this JSON string to the FLOGO_APP_PROPS_CONSUL
engine variable on the Data Plane.
Entering the Consul Parameter Values as a JSON String
To enter the Consul parameters as a JSON string, enter the parameters as key/value pairs using the comma delimiter. The following examples illustrate how to set the values as JSON strings.
FLOGO_APP_PROPS_CONSUL={"server_address":"[http://127.0.0.1:8500|http://127.0.0.1:8500/]"}
Refer to the Consul Connection Parameters section for a description of the parameters.
Refer to the Encrypting Password Values section for details on how to encrypt a value.