How to override config settings with system variables

When i read the comment here about adding properties with -D i tried to do the following:

java -Dgatling.graphite.rootPathPrefix=cnl1499.mysql -Dgatling.graphite.host=srv-nl-crd165 com.excilys.ebi.gatling.app.Gatling -s MYSimulation -df ./bin

But these -D values are not taken in account.
When diving into the source of GatlingConfiguration.scala i saw that it did not take the system properties in account.
After the following change it worked like expected :

old new
… … @@ -38,8 +38,9 @@ object GatlingConfiguration extends Logging {
38 38 val defaultsConfig = ConfigFactory.parseResources(classLoader, “gatling-defaults.conf”)
39 39 val customConfig = ConfigFactory.parseResources(classLoader, “gatling.conf”)
40 40 val propertiesConfig = ConfigFactory.parseMap(props)
41 + val systemConfig = ConfigFactory.systemProperties()
41 42
42 - val config = propertiesConfig.withFallback(customConfig).withFallback(defaultsConfig)
43 + val config = systemConfig.withFallback(propertiesConfig).withFallback(customConfig).withFallback(defaultsConfig)
43 44
44 45 configuration = GatlingConfiguration(
45 46 simulation = SimulationConfiguration(

Is this needed → can you get this in?
Or did i do something wrong in the first place?

OMG!
You’re completely right, I messed up.
Fixed: https://github.com/excilys/gatling/issues/1009

Thanks for reporting,

Stéphane

Hi Stephane,

Using Gatling-2.1.4 I'm trying to override the gatling.graphite.rootPathPrefix value by passing a value through the gatling-maven-plugin jvmArgs. This doesn't seem to work, is this not possible or am I doing something wrong here?

<plugin>
   <groupId>io.gatling</groupId>
   <artifactId>gatling-maven-plugin</artifactId>
   <configuration>
       <configDir>src/test/resources</configDir>
       <dataFolder>src/test/resources/data</dataFolder>
       <resultsFolder>target/gatling/results</resultsFolder>
       <bodiesFolder>src/test/resources/request-bodies</bodiesFolder>
       <simulationsFolder>src/test/scala</simulationsFolder>
       <noReports>true</noReports>
       <!--<reportsOnly>false</reportsOnly>-->
       <simulationClass>${applicationSimulation}</simulationClass>
       <jvmArgs>
           <jvmArg>-Dgatling.graphite.rootPathPrefix=${env.COMPUTERNAME}</jvmArg>
       </jvmArgs>
       <!--<fork>true</fork>-->
       <propagateSystemProperties>true</propagateSystemProperties>
       <!--<failOnError>true</failOnError>-->
   </configuration>
</plugin>

Cheers

Daniel

Hi Daniel,

Your syntax is invalid, remove -D

The configuration path for rootPathPrefix is gatling**.data**.graphite.rootPathPrefix.
The path you’re using is incorrect, which explains why it doesn’t work.

Note: you could also configure it directly from gatling.conf :

Cheers,

Pierre

Thanks!

<jvmArg>-Dgatling.data.graphite.rootPathPrefix=${env.COMPUTERNAME}</jvmArg> works fine for me.

Cheers

Daniel