ThingWorx Connection Server > Setting the Environment Variables for the Connection Server
Setting the Environment Variables for the Connection Server
Before starting the Connection Server, you must set the CONNECTION_SERVER_OPTS environment variable to point to your configuration file for the Connection Server and to the logging configuration file. If you are not encrypting the configuration file, continue to the next section. If you have encrypted your configuration file, see Setting the Environment Variable When Using an Encrypted Configuration, below.
Setting the Environment Variable When Using an Unencrypted 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 cxserver.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:
On Linux:
export CONNECTION_SERVER_OPTS="-Dconfig.file=/var/opt/connection-server-<version>/conf/
cxserver.conf -Dlogback.configurationFile=/var/opt/connection-server-<version>/conf/logback.xml"
On Windows:
set CONNECTION_SERVER_OPTS=-Dconfig.file=C:\connection-server-<version>\conf\
cxserver.conf -Dlogback.configurationFile=C:\connection-server-<version>\conf\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.
where:
<version> represents the major and minor version numbers (for example, 7.2) and the build number (for example, 2055).
-Dconfig.file specifies the full path to the configuration file for your Connection Server.
-Dlogback.configurationFile specifies the full path to your configuration file for Logback (if you are using it). To customize the logback.xml file, see Logging. For more information about configuring Logback, visit http://logback.qos.ch/manual/index.html.
* 
If you are using a custom logback.xml file and want to add dates to the timestamp entries in the Connection Server log, add the string, YYYY-MM-dd in the %d{} formatter. As of v.7.2.1 of the Connection Server, the logback.xml provided in the distribution bundle has this addition.
* 
After setting the environment variable, leave the shell or Command Prompt window open so that you can start the Connection Server.
Setting the Environment Variable When Using an Encrypted Configuration
To set up the Connection Server so that it will decrypt the encrypted configuration file, you need to know the paths to and names of the following files created when Setting Up an Encrypted Configuration File:
The encrypted configuration file for the Connection Server. For example, cxserver.conf.encrypted.
The encrypted.conf file that is used to encrypt the configuration file.
To set up the Connection Server so that it will decrypt the encrypted configuration file, add a secret.management.config.file property to the CONNECTION_SERVER_OPTS environment variable, as follows:
1. Set the environment variable for the configuration file:
On Linux:

export CONNECTION_SERVER_OPTS="-Dsecret.management.config.file=<your-encrypted.conf-path>/encrypted.conf
-Dconfig.file=<your-connector-config-path>/cxserver.conf.encrypted
-Dlogback.configurationFile=<your-connector-config-path>/logback.xml"
On Windows:

set CONNECTION_SERVER_OPTS=-Dsecret.management.config.file=<your-encrypted.conf-path>\encrypted.conf
-Dconfig.file=<your-connector-config-path>\cxserver.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 can start the Connection Server.
Setting an Environment Variable When Using SSL/TLS
If you configured the Connection Server 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 CONNECTION_SERVER_OPTS="-Djavax.net.ssl.trustStore=/etc/opt/java/
security/cacerts-customized -Djavax.net.ssl.trustStorePassword=new-password"
On Windows:
set CONNECTION_SERVER_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 Connection Server and ThingWorx Platform, add the TLSv1, TLSv1.1, and TLSv1.2 protocols to the CONNECTION_SERVER_OPTS environment variable before launching the Connection Server:
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 Connection Server and ThingWorx. Otherwise, to use the customized cacerts file 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 Connection Server and the ThingWorx Platform. You can now start the Connection Server.
Was this helpful?