Skip to main content
Skip table of contents

Creating a new environment file

An environment represents physical system configurations and combines server and connection settings into one convenient file. Among other things, environments store user ID and password information, database connection information, and deployment and connection information. 

You may define multiple environments in which to work on your model. These environments represent physical system configurations, such as Development, QA, Staging, or Production.  Once the environments are defined, you can move easily between the environmental settings. When deploying your model in NexJ Studio, you can select the environment file by clicking the Set Current Server button 

in the toolbar. When deploying using the command line, you specify the environment file using the -Dserver argument.

The recommended best practice is to use the environment file as a template that stores the configuration options and to use a properties file to specify configuration values. For more information, see Specifying environment properties through a properties file.

Your environment files may be encrypted using NexJ Studio to protect their contents. For more information, see Encrypting deployment  files.

Creating a new environment file using NexJ Studio

An environment file must be created before you can begin to configure your model.

To create a new environment file in NexJ Studio:

  1. In the Deployment layer, click the Environments tab.
  2. Right-click the list field in the Environments tab and select New Environment.
    The New Environment dialog opens.
  3. Give your environment a name and click Finish.
    The New Environment dialog closes.

An environment with the name you specified is now listed in the Environments tab. The environment file can also be found in the env folder of the project. You can now add environment arguments to the environment, either using the NexJ Studio environment editor or directly in the source by opening the environment file in a text editor. For a list of environment arguments and an example of environment file source, see Example environment settings for NexJ CRM deployment.

In new environment files, the httpGZip property is not initially set. It is recommended that you set it to true. This improves performance by activating Gzip compression for HTTP traffic and helps minimize network bandwidth use.

This setting is surfaced in NexJ Studio as the Compressed HTTP Response in the Communication tab.

You can split the environment file into separate server and connections files. In the Deployment layer, in the Environments tab, right click the environment file and select Extract to Server/Connections.

Specifying environment properties through a properties file

You can use a properties file to set your environment properties through variables. This removes the need to edit the environment file directly every time you modify a setting and is useful if you want to experiment with the property values For example, to use a different HTTP URL for unit testing and staging from that you use in production, you can create three separate properties files named  development.propertiesunittest.properties, and staging.properties, specify a different value for the httpURL property in each of the properties files, and set them all for use with the same environment file. 

The argument is specified in the environment file as a variable that refers to the properties file which is being used in the deployment. The property value is specified in the properties file and may be different for each properties file.

In case of a conflict, properties specified through the jvm.conf and modeld.conf files override the top-level variables in the environment file. For more information about jvm.conf and modeld.conf, see Specifying JVM arguments and system properties.

To use a property file for a Model Server deployment:

  1. Create one or more properties files as needed.

    You can create a properties file by one of the following methods:

    • In the env directory of your project folder, create a text file and change its extension to .properties
    • In NexJ Studio, open the environment in the Deployment layer. In the top right corner of the environment editor, click the dropdown next to the Open Properties button and select Add.
  2. In the properties file, specify property values in the following format:
    <propertyName>=<propertyValue>
    For example, callRecordsEnabled=true or cloneCount=1.
  3. In the  environment file, specify the property that needs to be pulled from the properties file in the following format:
    <environmentAttributeName>="${<propertyName>:<defaultValue>}"
    where  environmentAttributeName  is the attribute name as mentioned in the environment file, and  propertyName   is the name of the property in the properties file. The propertyValue associated with the property will replace propertyName. For example, callRecordSetting="${callRecordsEnabled:false}". When you deploy,  callRecordsEnabled  is replaced by true based on the setting in the properties file. If you did not specify the value in the properties file, then the default value of false is used.
  4. In the properties file, specify the environment file in the following format:
    config=<environmentFileName>.environment

    For example, config=development.environment.
  5. Save the files.

The properties files and environment file have been created and can be used in a deployment.

When you are ready to deploy, select the properties file you want to use for the deployment:

  • If using NexJ Studio, select the file from the Set current server dropdown.
  • If using the command line, specify the property file using the following command:
    -Dserver.properties=$<PROP_FILE> \

    where PROP_FILE is the name of the properties file you want to use for the environment, for example, staging.properties.

The server gets deployed with the mapped values from the selected properties file. 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.