Hi everyone, I have a working graphql test that passes in four headers that shouldn't be publicly exposed. I have this running locally and I want to share it with my team on github. In other languages, I create an .env and .env.example file. I upload the .env.example file with empty values for the key pairs. I ask my team to contact me for the values to put in their .env file. I put my full key value pairs in the .env file and then I put .env in .gitignore
I don't know how to do something like this for scala. If I do my normal .env file and then try to pass the parameter like such
.header("uid", $UID)
the file does not recognize $UID
Google/S.O searches say to use JAVA_OPTS but they don't say how to use java opts.
I tried adding it to the run configuration, but the run configuration doesn't recognize my test because it's .scala instead of .class
but adding anything into my class seems to create 500 errors as the test doesn't expect vals outside of functions. I guess that's my biggest problem in general reading answers on line, is even when I get the answer, I have no idea where to copypasta the code into. In my class, in another file? No idea
Here's my test with the params and company info abstracted so I'm not blasting it out to the world:
package specs
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class GraphQLSimulation extends Simulation {
val
httpProtocol = http
.baseUrl("
http://api.staging.<mycompany>.com") // Here is the root for all relative URLs
.header("uid", "<uid")
.header("access-token", "<access_token>")
.header("expiry", "<expiry>")
.header("client", "<client>")
.header("token-type", "Bearer")
.header("app", "mover")
val
scn = scenario("GraphQLScenario")
.exec(http("request_1")
.post("/graphql"))
.pause(2)
setUp(
scn.inject(atOnceUsers(10)).protocols(
httpProtocol))
}