Passing parameter to the simulation from SBT

I launch my test using sbt and task it:test.

I use the same Simulation to test on 3 different env.

Is there a way to pass the env to the Simulation, without launching again sbt ?

The way I have done it is to use a Typesafe Config that reads an environment variable, and then my Gatling code references the config variable, and reacts accordingly.

My config looks like this:

test { environment = "dev" environment =${?TEST_ENVIRONMENT} // this will override the value of environment if and only if the variable is set }

Then I read it with code like this:

`
object Test {
private lazy val userConfig = ConfigFactory.load()
private lazy val environmentConfig = ConfigFactory.load( “environment.conf” ) // the file referenced above
private lazy val config = userConfig.withFallback( environmentConfig )

lazy val environment = config.getString( “test.environment” )
}
`

What this lets me do is, I can do nothing, and it will default to the value in “environment.conf”. Or, I can create an “application.conf” file and put it in my class path, and in it I can create an override for test.environment. OR, I can create an environment variable TEST_ENVIRONMENT, and that value will override the value stored in “environment.conf”

Then, whenever I need to know the name of the environment, I simply type “Test.environment”. I then use the value of that string to build the path to an environment-specific config file, which tells me the URLs to hit, etc.

That help?

https://gist.github.com/aidylewis/ff12f6a243b1a2b83f021e4d6401442c