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
  1. Select the app that you want to run in Explorer View.
  2. Navigate to Explorer View > Flogo App Workspace and click the dropdown icon.

  3. Click the Run icon and select the Configure and Run icon.

  4. Set the following environment variable FLOGO_APP_PROPS_ENV=auto and 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.

Note: Currently, this functionality is only available for app properties mapped in activities. It is not available for app properties in triggers and connections.
Before you beginSet the following environment variables:
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

  1. In the Flogo activity, create an app property and map it to the activities as required.
  2. On Consul, create the same key as the app property and add some value.
  3. Run the app with the environment variables in the "Before you begin" section.
    The app takes all the values configured in Consul.
  4. Change the values in Consul.
  5. To reconfigure the app property values, use the API as follows:
    curl -X PUT localhost:7777/app/config/refresh
  6. A successful response is returned from the API.

  7. Open the app property update logs to verify that the new app property values are used by the activities.

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.