Questions tagged [environment-variables]

Environment variables are configuration options that can be set in a shell or other similar environments. All programs started from within the shell can read them and configure themselves.

Environment variables are key-value-pair configuration options like KEY=valueor FOO=bar. Environment variables allow you to configure a program before it gets executed and without the need to store these variables in proprietary configuration files.

They are present on all POSIX systems (Unix, Linux, BSD, Mac OS, DOS, Windows, ...). Environment variables can be set by any shell and read by nearly any programming language.

Some programming languages allow you to set Environment variables, but they only persist within the current process. You can't set them to be visible by the calling shell. So they are not useful for inter-process communication.

410 questions
0
votes
1 answer

Get rid of PULSE_* environmental variables

How can I get rid of these environmental variables? fryking@heimdal:~$ printenv | grep…
Civing
  • 183
  • 1
  • 7
0
votes
1 answer

What to do with trailing slash in $HOME on CentOS?

I have a little project server sandbox running CentOS. Setting up a new server package, I realized I needed to add new directory to the path and I found $HOME has a trailing slash for the main user. I can't find where this has been set. It's not…
xtian
  • 321
  • 3
  • 15
0
votes
1 answer

puppet variables set in exec environment not accessible elsewhere in the class

I'm trying to configure a logging figuration with log paths based on a check to see if that log file exists. However, the if statements always return true even though I know /var/log/hermes/hermes.log doesn't exist. I have tested the exec…
0
votes
1 answer

Is it possible to pass environment variables to a newly created user?

In my GitLab CI script, I am creating a new user which then executes a command. I'm noticing that when the command is executed as this user, the CI environment variables aren't available. Below is what I do: before_script: - useradd -U -d…
Anthony
  • 253
  • 1
  • 7
  • 10
0
votes
1 answer

What are the best practices for exporting secrets (passwords, keys) to the environment of systemd managed services?

What are the best practices for managing account credentials and SHA256 secrets and providing them to systemd managed services? In the old init.d way, I'd just install a script in /etc/default that gets sourced. From there I could import whatever…
Yermo Lamers
  • 111
  • 6
0
votes
1 answer

Method of maintaining read variable during while loop

After "Enter server name" and setting the $servselect variable in the script below the variable is lost after the "Hello" and "Goodbye" options are selected. This requires completing "Enter server name" prompt again. Is there a way to maintain that…
hashwagon
  • 67
  • 1
  • 8
0
votes
1 answer

Put server passwords in environment variable

Iam wondering, if it would be safe to put server variables as an environment variable in a ~/.bash_profile. Iam on a CentOS 6 shared host webserver. The passwords for the databases are currently available in .my.cnf and .my.mariadb.cnf. Would there…
BilliMoon
  • 3
  • 1
0
votes
1 answer

Environment specific configuration in puppet

I have a custom puppet module for setting up Apache web server and I use templates to copy the configurations. We have different environments like production, Quality Assurance, Integration testing. Each environment has one or more servers. The…
0
votes
1 answer

Diagnosing error in setting environment variable (Ubuntu based server, Django app)

In .profile found at /home/myuser/, I set an environment variable as follows: export API_TOKEN=xxxxyyyyxxxxyyyyyxxxxxyyyyyxx, and then running source ~/.profile. This server has a Django app on it; where I import the env variable in settings.py…
Hassan Baig
  • 2,325
  • 12
  • 29
  • 48
0
votes
1 answer

Defining own Atlas server via environment variable

Is it possible to define a company hosted atlas server via environment variable for vagrant commands. I can use vagrant box add ADDRESS to download a box file from each server. If i use vagrant box add hashicorp/precise64vagrant downloads the box…
0
votes
1 answer

Why does $SHELL point to /bin/bash if running zsh inside bash?

If I run zsh inside bash (on macOS Sierra), why does $SHELL still point to /bin/bash, rather then /bin/zsh? $ echo $SHELL /bin/bash $ zsh % echo $SHELL /bin/bash
otto.poellath
  • 545
  • 1
  • 5
  • 9
0
votes
1 answer

How can I set the same set of environment variables for multiple upstart daemons?

I have a bunch of job/daemon configuration files, say: /etc/init/service1.conf /etc/init/service2.conf /etc/init/service3.conf Most of those jobs are quite similar, and the files are of a format like: description "Some service" ... env…
houbysoft
  • 305
  • 2
  • 8
0
votes
1 answer

Set environment variables within parent shell using a command within a shell script

I have a shell script containing a single command sudo my_command | parse_to_exports_cmd when I run this script I get the following on stdout export MY_VAR_A=abcdef123 export MY_VAR_B=qwerty123 How would I modify my script to actually set these…
stevejpurves
  • 101
  • 1
0
votes
1 answer

Group Policy Management of Environment Variables - Update vs. Replace

I'm using the Group Policy Management Editor to add an environment variable to our Group Policy. In general, this environment variable shouldn't already exist on the host machines, but if it does, I'd like the Group Policy setting to completely…
Brendan Abel
  • 270
  • 1
  • 3
  • 13
0
votes
1 answer

Where should environment variables live in production?

I have a web application that is designed to be deployed to a dedicated host for each of my customers. In order to manage secret keys, customer-specific credentials, etc. in a secure way, I've turned to environment variables. Where should I define…
Adam
  • 223
  • 2
  • 7