Getting Started with eMessage Connector and eMessage Agents > Setting Environment Variables for an eMessage Connector
Setting Environment Variables for an eMessage Connector
Before starting the eMessage Connector, you must set the EMESSAGE_OPTS environment variable to point to your configuration file for the eMessage Connector and to the logging configuration file. The following examples use the name of the sample configuration file. If you copy/paste an example, make sure that you change <version> to show the version you are using, change the emessage-ha-sample.conf to show the exact name of your configuration file (if different), and remove the hard line break that is necessary to fit the commands on this page:
If you are using an encrypted configuration file, skip to the section When Using An Encrypted Configuration below.
On Linux, open a shell and enter the following:
export EMESSAGE_OPTS="-Dconfig.file=/var/opt/emessage-connector-<version>/
emessage-ha-sample.conf -Dlogback.configurationFile=/var/opt/emessage-connector-<version>/
logback.xml"
On Windows, open a Command Prompt using Run As Administrator and enter the following:
set EMESSAGE_OPTS=-Dconfig.file=C:\emessage-connector-<version>\
emessage-ha-sample.conf -Dlogback.configurationFile=C:\emessage-connector-<version>\
=======

* 
Make sure that you do NOT use double quotation marks on when setting the environment variable on Windows. If you use them, the Connector will fail to start.
* 
For publishing purposes, line feeds have been added to the commands listed above. If you want to copy and paste, make sure that you remove the extra line feeds.
The settings are as follows:
<version> represents the major and minor version numbers (for example, 1.0.1.0) and the build number (for example, 2055).
-Dconfig.file specifies the full path to the configuration file for your eMessage Connector.
-Dlogback.configurationFile specifies the full path to your configuration file for Logback (if you are using it). To customize thelogback.xmlfile, refer to Logging
For more information about configuring Logback, visit http://logback.qos.ch/manual/index.html.
If you are using SSL/TLS you also need to set the environment variable for that. Continue to When Using SSL/TLSfor SSL/TLS.
When Using an Encrypted Configuration File
To set up the eMessage Connector so that it will decrypt the encrypted configuration file, you need to know the paths to and names of the following files created whenSetting Up an Encrypted Configuration File for an eMessage Connector:
The encrypted configuration file for the eMessage Connector. For example,emessage.conf.encrypted.
Theencryption.conffile that is used to encrypt the configuration file.
To set up the eMessage Connector so that it will decrypt the encrypted configuration file, add asecret.management.config.fileproperty to theEMESSAGE_OPTSenvironment variable, as follows:
1. Set the environment variable for the configuration file:
On Linux:
export EMESSAGE_OPTS="-Dsecret.management.confg.file=<your-encryption.conf-path>/encryption.conf /
-Dconfig.file=<your-connector-config-path>/emessage.conf.encrypted
-Dlogback.configurationFile=<your-connector-config-path>/logback.xml"
On Windows:
set EMESSAGE_OPTS=-Dsecret.management.confg.file=<your-encryption.conf-path>\encryption.conf
-Dconfig.file=<your-connector-config-path>\emessage.conf.encrypted
-Dlogback.configurationFile=<your-connector-config-path>\logback.xml
* 
For publishing purposes, line feeds have been added to the commands listed above. If you want to copy and paste, make sure that you remove the extra line feeds.
2. After setting the environment variables, leave the shell or Command Prompt window open so that you set the environment variable for SSL/TLS.
When Using SSL/TLS
If you configured the eMessage Connector to use SSL/TLS for communications with ThingWorx platform,, follow these steps to set the environment variable and complete the SSL/TLS configuration:
1. Set the environment variable from the command line. Choose the command for your operating system:
On Linux:
export EMESSAGE_OPTS="-Djavax.net.ssl.trustStore=/etc/opt/java/
security/cacerts-customized -Djavax.net.ssl.trustStorePassword=new-password"
<baseDir>/emessage-connector-<version>-application/bin/emessage
On Windows:
set EMESSAGE_OPTS=-Djavax.net.ssl.trustStore=\path\to\cacerts-customized
-Djavax.net.ssl.trustStorePassword=new-password
2. To limit the secure protocol version used between the Connector and ThingWorx Platform, add the TLSv1, TLSv1.1, and TLSv1.2 protocols to theEMESSAGE_OPTSenvironment variable before launching the Connector:
For example:
-Djdk.tls.client.protocols=TLSv1
or
-Djdk.tls.client.protocols=TLSv1,TLSv1.1
3. If you did not need to create a new Trust Store, you have completed the setup for using SSL/TLS between the eMessage Connector and ThingWorx. Otherwise, to use the customizedcacertsfile that you created as the Trust Store, run the following command:
-Djavax.net.ssl.trustStore=/etc/opt/java/security/cacerts-customized
-Djavax.net.ssl.trustStorePassword=new-password
You have completed the setup for using SSL/TLS between the eMessage Connector and ThingWorx. You can now start the Connector.
Was this helpful?