Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
5 views

How to adjust the format of Win System Environmental variables “%date%”

I have a computer running Window Server 2008 R2 Standard. It runs several periodic tasks written by Windows cmd. Recently these batch jobs work improperly and i realize that the logic of the script ...
1
vote
0answers
38 views

Using Environment variable in proxy_pass nginx

I have nginx container where I want to forward an api call to another server. I want to pass in environment variables from Docker Compose to be able to change sites, without rebuilding the Docker ...
0
votes
1answer
35 views

Systemd service for a ruby rake job and environmental variables

I have many environmental variables that are required to run my ruby rake job. This job will be supervised by systemd. How can I export all the environmental variables? And also export them in such ...
-1
votes
0answers
23 views

load user environment variables macos launchdaemon

I have a plist file as below: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd "> <...
-3
votes
1answer
47 views

searching file for last matching line, then put 3rd word of this line into a variable

i have a logfile, a script checks this log-file every hour it shall pack the 3rd word of the last matching line into a variable but i didn't manage it to work yet .. logfile: 2018-11-18 22:27:10 ...
-1
votes
0answers
21 views

DEB postinst script that edits $PATH globally for all users including root? [duplicate]

I am building a deb package and I need to edit globally the $PATH in order to run a command everywhere and it runs the binary. So far I have no success. Trying this on Ubuntu 16.04/18.04. Right now my ...
0
votes
1answer
20 views

What are the rules regarding casing of values for environment variable USERNAME in Windows?

One of my customers says that in his AD usernames have mixed case sometimes and besides that, that people are able to successfully login using another casing of usernames. So there might be an ...
0
votes
0answers
14 views

Using shibboleth with out-of-process application servers

I have a legacy CGI application which I've convinced to run under plack (specifically, it runs in starman, but I don't think that's relevant to the question). The kinks around persistent vs. ...
0
votes
2answers
360 views

CloudFormation: How to export bash variable in the userdata so the vars would be available when the instance starts?

I wrote the following CloudFormation template: { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "company - LaunchConfiguration and AutoScalingGroup Template", "Parameters" : { ...
0
votes
0answers
39 views

How to get env vars in Docker Compose image to show up in registry?

I have a Docker Compose file. The Docker Compose file has an env_file: section in it. When I run the image locally, things work properly and the env vars populate as expected. However, when I run ...
3
votes
1answer
188 views

PowerShell: Format and sort environment variables

Using PowerShell I can get all (current process) environment variables and format and sort them: gci env: | %{"{0}={1}" -f $_.Name,$_.Value} | sort which gives: a=foo b=bar c=baz But that gives ...
3
votes
2answers
1k views

Getting environment variables in PHP-FPM with Nginx

I've defined some environment variables like APP_ENV in my /etc/environment file, on my ArchLinux. If I type printenv, I see them. I've created this simple test file called… test.php <?php ...
0
votes
0answers
62 views

How to restrict outbound ssh username credential to current user only

Is there a method to disallow a user from changing their outbound ssh credentials? I.e. restrict ssh -l username ip.address or ssh username@ip.address Further clarification. Only allow the username ...
0
votes
0answers
15 views

Keep local environment variables with policy kit?

Both sudo and policykit (pkexec) restrict the amount of environment variables one could use when executing a program via them. I have recently learned that sudo allows program builders a way for ...
0
votes
1answer
37 views

Is it fine if an external program edit the sudoers file?

My program needs some local environment variables while running as root to perform certain tasks. Would it be fine to write a subroutine that can change users sudoers to keep these variables? It's not ...
1
vote
0answers
315 views

How to escape/quote a dollar sign `$` in an env var in a php-fpm pool?

As symfony4 uses dotenv and environment variables for configuration, they are also needed on the server. to pass the variables it is possible to add the following to the pool config: example-pool....
0
votes
0answers
17 views

Easy way to manage environment variables

Our application reads environment variables as parameters. The app has 2 interfaces: web (apache virtual host) CLI (shell scripts) Apache runs as nobody and is not using suExec or any other method ...
6
votes
1answer
866 views

Cron job running a Django Python command through a virtual environment not working

I have a crontab file supposedly executing a Django command after loading the project virtual environment: */1 * * * * source /home/virtualenvs/mydjangoproject-venv/bin/activate && python /...
1
vote
2answers
2k views

Apache Custom Header with an environment variable

I try to set a custom HTTP Header with an environment variable** with Apache server 2.4.6 and headers_module. I work inside a HTTP VHost on port 80. Everything work as expected with basic example ...
0
votes
2answers
89 views

Call app with sudo and custom environment variable

I need to call sqlplus with oracle user sudo to clearly specified DB (env var ORACLE_SID) by one line command. The usual way to do it consists of 2 steps: $ sudo -u oracle -i $ ORACLE_SID=DBNAME ...
0
votes
1answer
540 views

Passing inner quotes from EnvironmentFile variable to ExecStart

In the EnvironmentFile I have: EBUSD_OPTS="--scanconfig -d /dev/ttyEBUS -c /etc/ebusd --log=\"all notice\" --log=\"update error\"" In the .service file: EnvironmentFile=-/etc/default/ebusd ...
0
votes
1answer
501 views

Apache 2.4: Set user dependent environment variable

I just wondered if it's possible to set an environment variable depending on the basic authentication user. I tried the following versions, but none of them work (obviously none of them is documented ...
1
vote
1answer
3k views

apache get environment variable value

I would like to get the value of a environment variable and assign it to another variable in Apache. For example, get the value of $_SERVER['REMOTE_ADDR'] assign it to $_SERVER['USER-IP'] and ...
0
votes
1answer
332 views

How do I explicitly set %PATH% in System Variable or User Variable in command prompt in a persistent manner?

When you open sysdm.cpl -> Advanced -> Environment Variables. you can see that envs are divided into two section: one is User Variables, another is System Variables, they both have a variable PATH in ...
0
votes
1answer
1k views

APACHE SetEnv directive (from .htaccess) not send to CGI process

I don't understand Apache2 mecanism in this scenario : 1/ In this location : var/www/cgi-bin/ (user's group rights : www-data) i've a CGI script (php-cgi) who will execute PHP app + VAR environement ...
21
votes
6answers
4k views

What are the advantages of putting secret values of a website as environment variables?

The devops guidelines at https://12factor.net/config suggest to put website secrets (database passwords, api keys, etc.) into environment variables. What advantages does that have instead of using ...
2
votes
1answer
838 views

Scripts in /etc/profile.d are being executed twice on login

Background Info: I am trying to configure a Linux server running CentOS 7 for multiple users. After installing java I want to globally set the $JAVA_HOME environment variable for all users and add it ...
-1
votes
1answer
42 views

Calling a utility by name, without the full path, from cron doesn't work [duplicate]

I have some console utility installed. It's in /usr/local/bin/my_utility. I can call it as my_utility and it works well. I've created a cron task which runs a bash script. That bash script calls ...
0
votes
1answer
603 views

Docker conatiner: Get passed environment varaible in tomcat spring mvc application

I am trying to deploy a SpringMVC application within a Docker container on top to tomcat8. My problem is This SpringMVC application receive parameters using following code String username = System....
1
vote
1answer
406 views

Why isn't IIS on Windows Server 2012 able to access system environment variables?

I have an ASP.NET Core web application running on Windows Server 2012 R2 and IIS 8.5. IIS uses a pair of web.config configuration variables to start up the application. This is the relevant web.config ...
0
votes
1answer
123 views

apache2 not picking up TNS_ADMIN environmental variable

I am trying to set 2 environmental variables for use in apache: LD_LIBRARY_PATH TNS_ADMIN. I set these in: /etc/apache2/envvars The former is picked up and set correctly, but the latter is not. I'...
2
votes
1answer
347 views

Set environment variables from header for Ruby/Rails app hosted in Nginx/Passenger

I installed a server for Redmine, running with Nginx/Passenger. The server also hosts Gitlab and it goes well. I put some kind of SSO plugin for Redmine (which I found and installed) and it needs an ...
0
votes
1answer
54 views

Get rid of PULSE_* environmental variables

How can I get rid of these environmental variables? fryking@heimdal:~$ printenv | grep PULSE PULSE_CLIENTCONFIG=/usr/NX/var/run/nxdevice/D-1002-02BEA0333F591B469FD130F503B146D4/audio/client.conf ...
-1
votes
1answer
213 views

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. ...
1
vote
1answer
463 views

Use basic auth conditionally in nginx

I have an NGINX server built into Docker image which I want to use in both production and staging environments. The problem is that staging environment requires a Basic Auth to be enabled in order to ...
3
votes
1answer
6k views

How to use variables in a systemd service file?

I'm creating a service file for a daemon, and I would like to use variables (in init scripts I used environment variables) to define some parameters for the executed scripts. For example, I would like ...
0
votes
1answer
434 views

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 ...
0
votes
1answer
151 views

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 ...
0
votes
1answer
350 views

How to Easily Pass an Environment Variable to an .exe in “Bash on Windows 10”?

I am looking for a way to easily pass an environment variable to a .exe when invoked from the Bash on Windows 10 terminal. It seems that TEST=somevalue example.exe does not work.
0
votes
1answer
377 views

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 ...
0
votes
1answer
46 views

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 ...
0
votes
1answer
103 views

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 ...
1
vote
0answers
496 views

Behaviour of environment variables in HKCU\Volatile Environment reg key

I have a .bat script that runs for every user at login (copies Oracle Java Exception Sites). It copies a file to: %userprofile%\appdata\LocalLow\Sun\Java\Deployment\security\exception.sites ...
2
votes
1answer
889 views

In a nginx configuration file, how to define a fastcgi_param that contains the “$” sign?

I'm trying to define a few environment variables for a PHP application but one of these variables contains the "$" sign. When I test the configuration file with nginx -t, I get an error message ...
1
vote
1answer
2k views

Passing multiple environment variables a process managed by a supervisor

I need to proxy multiple environment variables from /etc/environment to a process managed by a supervisor. The following configuration worked for me with supervisor 3.0r1-1 but supervisor 3.2.0-2 ...
0
votes
1answer
88 views

How to set LESSCHARSET system wide?

This is a follow up on How to make the 'less' command handle UTF-8? If I want to set options for less globally, so that each user doesn't have to fiddle with their own env vars (.basrc, etc) ...
0
votes
1answer
234 views

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. ...
0
votes
1answer
35 views

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; ...
0
votes
1answer
77 views

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 ...
1
vote
1answer
3k views

Pass environment variables to the PHP CLI and FPM

I want to use environment variables in my PHP applications both CLI and FPM. What I do is I: export some variables in /etc/environment. configure both php.ini (CLI and FPM) to variables_order = "...