question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow (process) env vars to be used as Environment Variables

See original GitHub issue

Similar to #647 but instead of passing variables as command line switches, allow process.env vars to be used as (Postman) Environment Variables where none already exists. In other words a Postman Environment Variable (api_url) would have precedence over process.env.API_URL.

This is desirable because there are some environment specific settings (passwords) that I don’t want to store in the .postman_environment.json file (which is checked in to source control). Yes, I can rewrite my .postman_environment.json file before I call newman run but using process.env would be more convenient.

Any other suggestions welcome 😃

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:7
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
kunagpalcommented, Aug 11, 2017

As discussed earlier, automatic insertion brings with it security concerns. You’d have to use the --global-var option as demonstrated above. The former section in my previous comment was just a working sample.

3reactions
englishm-llnwcommented, Sep 18, 2017

I understand the concern for users who may inadvertently allow the exfiltration of sensitive environment variables by malicious collections. However, there is another security concern to consider here, too.

On many UNIX-family operating systems, the full command line (including arguments) for each process is visible to all. This means that if I want to pass an API token to a collection and use newman run collection.json --global-var token=$token, the value of $token (expanded by the shell) will be visible to all users on the host where newman is running. This is not ideal, especially on shared hosts like build servers.

I like @gaieges’s suggestion of filtering by a NEWMAN_ prefix.

Alternatively, a list of specific variable names to import could be provided as a command line argument. For example:

newman run collection.json --shell-env-vars token,url

With considerations like the above, shell environment variables could actually be more secure than command line arguments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Environment Variables in Node.js - Twilio
Environment variables are a great way to configure parts of your Node.js application. Learn how to work with them using helpful tools such ......
Read more >
Setting Environment Variables for Node to retrieve
You can set the environment variable through process global variable as follows: process.env['NODE_ENV'] = 'production';.
Read more >
Node Environment Variables: Process env Node
Node environment variables are strategies to define and consume environment-specific configurations and process env node. Learn how.
Read more >
Using Environment Variables in Node.js for App Configuration ...
Set the NODE_ENV environment variable to "development" , enabling debug mode in your development environment; Provide environment-specific ...
Read more >
How to use environment variables in Node.js | by Ali Kamalizade
Let's take a look how you can use custom environment variables in Node. I can recommend the dotenv module which makes it easy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found