We could really use a way to pass an environment variable on the command line. We have set up environments and can specify an environment file from the command line, but I do not want to put secrets in the environment files. Things like oauth2 secret key should be passed in for a run and added to (or override) variables specified in the environment file.
This would be useful when running from Jenkins. We could put the oauth2 secret in the Credentials Store and pass it to the pipeline code using the withCredentials wrapper.
@michaelajr Support for this is being worked on in #1138, we'll update this thread with time 馃槃
@kunagpal GREAT! Thank you!
@michaelajr This has been released with Newman v3.8.0, please see https://github.com/postmanlabs/newman#newman-run-collection-file-source-options for details on how to use this feature 馃槃
It seems we can passing --env-var "my_environment_variable=foo" too, but not documented in README.md file (https://github.com/postmanlabs/newman#newman-run-collection-file-source-options) @kunagpal
@yw-m-id - The documentation still doesn't list this out. Do you know if a variable is passed via both the environment file and as an environment variable, which is going to take precedence?
The variable overwrites the environment json file
Most helpful comment
@michaelajr This has been released with Newman
v3.8.0, please see https://github.com/postmanlabs/newman#newman-run-collection-file-source-options for details on how to use this feature 馃槃