Modifying Configuration with Environment Variables

Environment variables can be used to modify aspects of Java Virtual Machine (JVM) configuration or how a software process is executed.

Java Application Environment Variables describes environment variables that are available to all MATRIXX Java-based Docker containers.

Table 1. Java Application Environment Variables
Environment Variable Description Default Example
MTX_LOG_CONFIG The filename of the Log4j 2.x configuration file to use. This includes the full path if the file is outside of the classpath. log4j2.xml file:///opt/mtx/conf/log4j2-debug.xml
MTX_JVM_ARGS The JVM arguments to add when running the Java process. -Xss16m
MTX_JAVA_CP The classpath to use when executing the Java process. This is a comma separated list of paths. /opt/mtx/ext/common, /opt/mtx/ext/payment-service
MTX_JAVA_ARGS The Java application arguments to use when running the Java process. abc
MTX_JFR_ENABLED A value of true enables Java Flight Recorder for the Java process. Use for troubleshooting and analysis. Java Flight Recorder is not intended to run in a production environment. For more information, see the discussion about Java Flight Recorder. true
MTX_SPRING_PROFILE A comma separated list of Spring Boot profiles to enable as applicable. This is only applicable if the application type (MTX_APP_TYPE) is springboot. docker debug,docker
MTX_WAIT_FOR_TIMEOUT The amount of time in seconds to wait for a resource. This is only applicable if values for MTX_WAIT_FOR_HOST and MTX_WAIT_FOR_PORT have been specified. 60 120
MTX_WAIT_FOR_HOST The host on which the port specified in MTX_WAIT_FOR_PORT must have traffic before the Java process starts. rsgateway
MTX_WAIT_FOR_PORT The port on the host specified in MTX_WAIT_FOR_HOST that must have traffic before the Java process starts. 8080
MTX_HEALTHCHECK_URL The URL to call after the application PID file has been created. This URL should return HTTP 200 after the application is healthy. This is used to check the process has started when running as a detached process or when running the check process script. http://localhost:9095/actuator/health
MTX_HEALTHCHECK_PORT The port on the host system specified with MTX_HEALTHCHECK_PORT_HOST to check after the application PID file has been created. This port should be open for traffic after the application is running correctly. Use the status of this port to check the process has started when running as a detached process or when running the check process script. 4070
MTX_HEALTHCHECK_PORT_HOST The host on which to perform the port health check, at the port specified with MTX_HEALTHCHECK_PORT. 0.0.0.0
MTX_HEALTHCHECK_TIMEOUT The number of seconds to wait when performing a port or URL-based health check on the application. 60 120
MTX_SCHEMA_VERSION The schema version to pin the component to (if applicable). This is used during the process of upgrading MATRIXX to ensure that MDCs sent to MATRIXX Engine are at the previous version until MDCs at the new version can be correctly interpreted. 5200
MTX_PROVIDER_SCHEMA_VERSION The provider schema version to pin the component to (if applicable). This is used during the process of upgrading MATRIXX to ensure that MDCs sent to MATRIXX Engine are at the previous version until MDCs at the new version can be correctly interpreted. 2

The following java -cp command shows example usage of some of the environment variables:

java -cp $MTX_JAVA_CP $MTX_JVM_ARGS -Dlog4j2.configurationFile=$MTX_LOG_CONFIG -jar $MTX_JAR_FILENAME $MTX_JAVA_ARGS

The following Java command shows example usage of some of the environment variables for a Spring Boot application:

java $MTX_JVM_ARGS -Dloader.path=$MTX_JAVA_CP -Dlogging.config=$MTX_LOG_CONFIG -jar $MTX_JAR_FILENAME $MTX_JAVA_ARGS