Overriding an App Property at Runtime
The following section discusses how to override an app property at runtime in the following scenarios:
Overriding Using Configure and Run Locally
When running an app, you can override an app property by performing the following steps:
- Procedure
- Select the app that you want to run in Explorer View.
- Navigate to Explorer View > Flogo App Workspace and click the dropdown icon.
-
Click the Run icon and select the Configure and Run icon.
-
Set the following environment variable
FLOGO_APP_PROPS_ENV=autoand add the app properties as comma-separated key-value pairs.
Overriding without Restarting or Redeploying the App
When using config management services, such as Consul or AWS Params store, you can update or override an app property at runtime without restarting or redeploying the app.
| Environment Variable | Description |
|---|---|
| FLOGO_APP_PROP_RECONFIGURE=true | Specifies that app properties can be updated or overridden at runtime. |
| FLOGO_APP_PROP_SNAPSHOTS=true | Used along with FLOGO_APP_PROP_RECONFIGURE. If this variable is set to true, the app keeps the app properties the same for the entire flow. Even if you change the app properties while the flow is running, the new properties are effective only for new flows and not existing ones. |
| FLOGO_HTTP_SERVICE_PORT=<port number> | Specifies the service port. For apps running in TCI, you do not need to specify the port. The default is 7777. |
| FLOGO_APP_PROPS_CONSUL="{"server_address":"http://127.0.0.1:8500"}" | Specifies the Consul server address. |
Overriding Values by Specifying New Values in Consul
- In the Flogo activity, create an app property and map it to the activities as required.
- On Consul, create the same key as the app property and add some value.
-
Run the app with the environment variables in the "Before you begin" section.
The app takes all the values configured in Consul. - Change the values in Consul.
-
To reconfigure the app property values, use the API as follows:
curl -X PUT localhost:7777/app/config/refresh
- Open the app property update logs to verify that the new app property values are used by the activities.
A successful response is returned from the API.
Overriding Values by Specifying New Values in the API Directly
You can specify the new values of app properties directly through the body of the reconfigure API. This method takes priority over any other resolver specified.
Example:
curl -X PUT -H "Content-Type: application/json" -d '{"Property_1":"Value"}' localhost:7777/app/config/refresh
Important Considerations
-
If the same property exists in Consul, the property from the body of the reconfigure API is used.
-
Any new request on the API does not save property values provided on a previous request.
-
Properties mentioned in an earlier request and not mentioned in the new request take values if present from other resolvers mentioned or the last saved value.
-
Properties that are not mentioned in any resolver take the default values.