Newman: Feature Request: Pass environment variables on the command line

Created on 3 May 2017  路  7Comments  路  Source: postmanlabs/newman

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.

enhancement feature request in progress

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 馃槃

All 7 comments

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

Was this page helpful?
0 / 5 - 0 ratings