Questions tagged [environment-variables]

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.

Environment variables are a set of dynamic-named values that can affect the way running processes will behave on a computer. They can be said in some sense to create the operating environment in which a process runs. For example, an environment variable with a standard name can store the location that a particular computer system uses to store temporary files—this may vary from one computer system to another. A process which invokes the environment variable by (standard) name can be sure that it is storing temporary information in a directory that exists and is expected to have sufficient space.

https://en.wikipedia.org/wiki/Environment_variable

13704 questions
134
votes
4 answers

Define a Makefile variable using a ENV variable or a default value

I am trying to do a simple thing: TMPDIR ?= /tmp test: @echo $(TMPDIR) This works if I run: $ make test /tmp It also works if I run: $ make test -e TMPDIR=~/tmp /home/user/tmp What can I do to also have it works for: $ TMPDIR=~/tmp make…
Natim
  • 17,274
  • 23
  • 92
  • 150
133
votes
4 answers

What is the correct way to unset a linux environment variable in python?

From the documentation: If the platform supports the unsetenv() function, you can delete items in this mapping to unset environment variables. unsetenv() will be called automatically when an item is deleted from os.environ, and when one of the…
fredley
  • 32,953
  • 42
  • 145
  • 236
133
votes
9 answers

Kubernetes equivalent of env-file in Docker

Background: Currently we're using Docker and Docker Compose for our services. We have externalized the configuration for different environments into files that define environment variables read by the application. For example a prod.env…
Johan
  • 37,479
  • 32
  • 149
  • 237
133
votes
5 answers

How can I see the current value of my $PATH variable on OS X?

$ $PATH returns: -bash:…
Karoh
  • 2,390
  • 3
  • 23
  • 29
131
votes
6 answers

Tomcat - CATALINA_BASE and CATALINA_HOME variables

I have multiple instances of tomcat 6 running on the same server (Linux) and it works as expected. I am trying to find out what the standard practice is with regards to setting the CATALINA_HOME and CATALINA_BASE variables. In my tomcat…
souser
  • 5,868
  • 5
  • 35
  • 50
130
votes
11 answers

How to set environment variable or system property in spring tests?

I'd like to write some tests that check the XML Spring configuration of a deployed WAR. Unfortunately some beans require that some environment variables or system properties are set. How can I set an environment variable before the spring beans are…
Dr. Hans-Peter Störr
  • 25,298
  • 30
  • 102
  • 139
128
votes
4 answers

Setting environment variables for accessing in PHP when using Apache

I have a Linux environment and I have a PHP Web Application that conditionally runs based on environment variables using getenv in PHP. I need to know how these environment variables need to be set for the application to work correctly. I am not…
Abishek
  • 11,191
  • 19
  • 72
  • 111
127
votes
9 answers

Node.js setting up environment specific configs to be used with everyauth

I am using node.js + express.js + everyauth.js. I have moved all my everyauth logic into a module file var login = require('./lib/everyauthLogin'); inside this I load my oAuth config file with the key/secret combinations: var conf =…
andy t
  • 3,767
  • 3
  • 19
  • 14
127
votes
10 answers

Environment Variable with Maven

I've ported a project from Eclipse to Maven and I need to set an environment variable to make my project work. In Eclipse, I go to "Run -> Run configurations" and, under the tab "environment", I set "WSNSHELL_HOME" to the value "conf". How can I do…
Gianluca
  • 2,379
  • 3
  • 25
  • 41
127
votes
4 answers

Can we pass ENV variables through cmd line while building a docker image through dockerfile?

I am working on a task that involves building a docker image with centOs as its base using a Dockerfile . One of the steps inside the dockerfile needs http_proxy and https_proxy ENV variables to be set in order to work behind the proxy. As this…
Aniketh
  • 1,411
  • 3
  • 12
  • 15
125
votes
5 answers

how to get program files x86 env variable?

I would like to know how I can display the location of Program Files (x86) in Command Prompt. I'm using Windows 7 64bit. I've tried: echo %programfiles(x86)% and echo %programfiles%. Both of these output C:\Program Files When I manually checked the…
Ashok
  • 1,902
  • 3
  • 22
  • 30
123
votes
13 answers

how to read System environment variable in Spring applicationContext

How to read the system environment variable in the application context? I want something like : or
jai
  • 21,519
  • 31
  • 89
  • 120
122
votes
12 answers

How do you avoid over-populating the PATH Environment Variable in Windows?

I would like to know what are the approaches that you use to manage the executables in your system. For example I have almost everything accessible through the command line, but now I come to the limit of the path string, so i can't add any more…
mjsr
  • 7,410
  • 18
  • 57
  • 83
122
votes
6 answers

Updating PATH environment variable permanently in Docker container

I tried adding to the PATH in the files ~/.profile and /etc/profile as follow. PATH = $PATH:/required/path However, it does not work. Then I tried with adding the line show, which did not work either. export PATH It did not work even after…
user859375
  • 3,529
  • 5
  • 21
  • 22
122
votes
15 answers

Securely storing environment variables in GAE with app.yaml

I need to store API keys and other sensitive information in app.yaml as environment variables for deployment on GAE. The issue with this is that if I push app.yaml to GitHub, this information becomes public (not good). I don't want to store the info…
Ben
  • 5,085
  • 9
  • 39
  • 58