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 use the interactive
streamtool
interface to create the application configuration object, run thestreamtool 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 interactivestreamtool
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:
Accessing application configuration objects in applications
To retrieve the contents of an app config in an application, the application may:
- Configure operators to use an app config if the operator has the parameter(s) to do so.
- Use the getApplicationConfiguration functions.