Using application configuration objects to access secure data

Use application configuration objects to securely access sensitive configuration items from your Teracloud® Streams environment.

Application configuration objects (app configs) enable you to store sensitive information in a central location rather than in config files or within your application.

Common types of information to put into an app config include:

  • Database or service connection information
  • Credentials

App configs must be created in your Teracloud® Streams environment and stream applications must configure operators or call appropriate functions to use them.

Creating an application configuration object

    To create an application configuration object, use one of the following interfaces:
  • To use the interactive streamtool interface to create the application configuration object, run the streamtool mkappconfig command:
    mkappconfig [-d,--domain-id did] [-i,--instance-id instance]
      [--description description] [--property name=value] ... 
    [--propfile property-file] [-U,--User user]
    [-h,--help] [--trace level] 
    [-v,--verbose level] config-name

    Replace the config-name variable with the name that you want to use for the application configuration object. This is the name that an application must use to retrieve the application configuration object.

    You can specify the properties of the application configuration object by:
    • Pulling the values from a properties file by specifying the --propfile option.
    • Specifying each name-value pair individually by specifying the --propertyoption for each property.
    Tip: If you specify a value for both the --propfile option and the --property option, the values that are specified in the --property option override any values that are specified for the same property in the file that is specified by the --propfile option.
    If you specify each property manually from the interactive streamtool interface, your command might look something like this:
    mkappconfig --property userName=dbUserName
    --property password=dbPassword dbConnectConfig
  • To use the Teracloud® Streams Console to create the application configuration object:
    1. From the Management Dashboard, go to the Manage Application Configurations page.
    2. If you want to create the application configuration object on a specific instance rather than at the domain level, select the instance from the Scope field.
    3. Click Add Configuration.
    4. Specify the name and description for the application configuration object.
    5. Add the application configuration object properties in one of the following ways:
      • Manually specify the property names and values by entering them in the Name and Value fields and then clicking Add to table
      • Import the property names and values from a properties file by completing the following steps:
        1. Click Import properties by uploading a file and click Browse.
        2. Select the file from your local file system and click Open.
        3. Click Upload properties
    6. Click Save App Config.

Accessing application configuration objects in applications

To retrieve the contents of an app config in an application, the application may:

  1. Configure operators to use an app config if the operator has the parameter(s) to do so.
  2. Use the getApplicationConfiguration functions.