Log out?

Our Blog

Using Multiple Environment Settings Files

Introduction

It is a common scenario when environment specific configurations will change from one deployment environment to another. PilotFish’s environment settings, also known as environment properties, help to make this a simple task.

Not only can environment settings be used to store global variables across multiple configurations, separate settings files can be provided for different environments. It is also possible to have each environment know which settings file to use.

Use Multiple Environment Settings Files

The first part of accomplishing this is keeping multiple environment settings files with different names. This can be accomplished with a simple suffix, such as “environment-settings-dev.conf” for development and “environment-settings-prod.conf” for production. This allows for separate sets of values in each file.

These files should be kept in sync at all times. What this means is every single property key should exist in both files, whether or not the values are different.

Configure Environments To Use The Right File

By default, the PilotFish eiConsole and eiPlatform will always search for a file simply called “environment-settings.conf” and use that for any environment properties. However, this setting can be changed on a per-installation basis. This means that any individual instance of the eiConsole or eiPlatform can be configured to load its environment settings from a different file, even if they’re all using the same working directory. This allows for the environment settings files to all be kept in the working directory together, which makes it easier to manage and deploy them.

This configuration is done by a Java VM Option property called “com.pilotfish.eip.environmentSettings.file”. This property tells the application the name of the environment settings file to use.

Like all Java VM Option properties, it must be prefixed with “-D” to make it work. So the full expression to assign this new environment settings filename would be as follows:

  • “-Dcom.pilotfish.eip.environmentSettings.file=environment-settings-prod.conf”

Where to Configure This VM Option

There are two main places to configure this VM Option. Which one depends on how the application is deployed.

  1. Application Container With eip.war

    For an eip.war deployed to an application container, the VM Option needs to be added to the container itself. Each container is pre-configured to accept VM Options in some way. For example, Tomcat accepts them via the CATALINA_OPTS environment variable.

  2. eiPlatform Windows

    For the eiPlatform Windows, there is a special file in the root of the application installation directory called “eiPlatform Service.vmoptions”. Any VM Options placed into this file will be applied when the eiPlatform service is started. Simply add the option on a new line in the file.

    If the file doesn’t exist for some reason, simply create it in that directory with the same exact name.

  3. eiConsole Windows

    For the eiConsole Windows, the process is mostly the same as the eiPlatform Windows. There is a special file in the root of the application installation directory called “eiConsole.vmoptions”. Any VM Options placed into this file will be applied when the eiConsole is started. Simply add the option on a new line in the file.

    If the file doesn’t exist for some reason, simply create it in that directory with the same exact name.

Please note that the application must be restarted after this VM Option has been applied.

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

This is a unique website which will require a more modern browser to work! Please upgrade today!

Thanks!

Our editors are notified.

Close