Set environment variable in Gatling plugin

Hi all,

I’m using Gatling plugin

<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>4.1.3</version>

Where in my Java Simulation I’m trying to get some environment variables using

System.getenv(key)

For now I tried several things without success like add in the plugin

<simulationSystemProperties>
						<DELAY_SERVICE_NAME>bla</DELAY_SERVICE_NAME>
					</simulationSystemProperties>
					<propagateSystemProperties>true</propagateSystemProperties>

Any idea how to accomplish this?

Regards.

This is a standard Java question, really not related to Gatling.

You’re confusing environment variables and Java System Properties.

You have to use System.getProperty(key) .

Thanks for the answer, I need to get environment variable from Java, also the code that grab this env var is not part of my code, but an external library so System.getenv(key) is mandatory

I just use simulationSystemProperties since it was the only thing that I saw in the plugin.

Any way to set environment variables in the plugin?

Environment variables are process context properties that get automatically propagated to children processes. This is not the case for Java System properties, hence simulationSystemProperties to be able to set system props for the child Java Gatling process and propagateSystemProperties to have maven system props transferred.

Do a export DELAY_SERVICE_NAME=bla before launching your maven process.

We don’t provide a way to set env vars.

Thank you to confirm.