lighttpd not making global environment variables availble to executables - linux

How to set up lighttpd in order to make environment variables available to spawned processes?
I have an executable being called through CGI as an URL (e.g. http://.../cgi-bin/executable.bin).
The executable needs to load libraries and read environment variables that are set in /etc/profile using export FOO=BAR.
When I try to access the URL, it generates Internal Server Error (500), caused by an empty environment variable, which are properly set in /etc/profile.

I ended up enabling mod_setenv in modules.conf and including each environment variable I needed like this:
##
## mod_setenv
##
setenv.add-environment = ( "PATH" => env.PATH,
"WSFC_HOME" => env.WSFC_HOME,
"LD_LIBRARY_PATH" => env.LD_LIBRARY_PATH )

Related

Access to ENV variables defined in ${workspaceFolder}/.env files

For a project I need to define the ENVIRO variable (and some others) with the values prod/stage/dev.
This variable is used in .devcontainer/docker-compose.yml, .devcontainer/Dockerfile, some shell scripts and the Python source to set paths and the like.
Therefore I defined the file ${workspaceFolder}/.env which is imported by the Python extension like described here:
ENVIRO=dev
...
To avoid to execute / debug my code in the wrong environment, I wanted to create a little VSC extension, which does nothing else than to show the value of the ENVIRO variable in the Status Bar at the bottom.
Now the problem. In the extensions activate function I don't get access to the ENV variables defined in .env file:
const envValue = process.env["ENVIRO"];
// gives: undefined
In an terminal in the same VSC instance:
echo $ENVIRO
# gives: dev
When I access ENV variables defined by the system (not the .env file), there is no problem to access them in the extension's activate function:
export function activate( context: vscode.ExtensionContext) {
const envValue = process.env["NVM_BIN"];
// gives: '/Users/andi/.nvm/versions/node/v14.15.1/bin'
Is there no way to access this variable?
My suspicion is following:
The Python extension extends the Environment with the variables using the EnvironmentVariableCollection
This adds them to the terminal environment, but prevents access to the variables in other extensions.
Or do I (hopefully) miss something?

Setting multiple environment variables using Puppet

Currently I am using
file {"/etc/profile.d/setjvmparams.sh":
ensure => file,
owner => root,
source => "puppet:///modules/java/setjvmparams.sh",
}
But I want to remove dependency of my module on external files. Is there a way out to set env variable?
Note: setjvmparams.sh has 3 lines.
I want to put paths in /etc/profile.d and source it.

environment variable in a config.properties file

I'm trying to compile a Maven project that has a config.properties file. In the file, I have a set of environment variables that I have to set before compile.
In the config.properties file the variables are called like this:
${sys:rdfstore.host}:${sys:rdfstore.port}/openrdf-sesame/repositories/iserve/rdf-graphs/service
How do I have to set the variable rdfstore.host, and to what value should I set it to?
I have tried to solve this with:
export rdfstore.host="localhost"
However, with this I obtain a msj that is a invalid identifier, because
it has a point "." How can I solve this problem?
You should be confusing environment variables and the set of sytem properties:
The properties exported from your system as you did with the export command are called environment variables and should not contain dots in the name.
Those properties are then refered to using ${env.XXX}, meaning in your case you should change the variable name to:
export RDFSTORE_HOST="localhost"
It can then be referred to as below:
`${env.RDFSTORE_HOST}`
System variables are those introcued in command line when invoking a maven phase, those ones can host dots in their names:
mvn -Drdfstore.host="localhost"
They can be referred to as follows:
${rdfstore.host}
You can find more informations in the maven properties manual.

How to give version to a module loaded on HPC

I am very new to linux environment and I have an issue with loading a module in linux. The problem is I am trying to point an already loaded module to the one present in my local directory. For this I have changed all the path that would point the module to my local directory and also updated the MODULEPATH with my local directory path.
This is the command I am using for changing the MODULEPATH
export MODULEPATH=~/local/directory:${MODULEPATH}
Though the question I have is completely different, how to give a version number to my module?
I have a moudle file which looks like this -
#%Module
proc ModulesHelp { } {
puts stderr "Sets up users' environment to use XXXX. XXXX is the ..\n.. It is a piece of middleware developed by XXXX to \nhelp track XXX usage. \n\nIf you encounter any problems while linking or while executing aprun, please unload this module."
}
conflict totalview
setenv XXXX_SELECT_ON 0
setenv XXXX_SELECT_USERS kagrawa1
setenv XXXX_SELECT_OFF_USERS ""
setenv XXXX_VERBOSE 0
setenv XXXX_ON 1
setenv XXXX_PATH /d/home/kpilagr/
prepend-path PATH /nics/d/home/kagrawa1/altd/bin

Can any one explain the usage of Shell::Source perl module or Shell::GetEnv module

I m a beginner in perl. I want to know how to use this module. I read somewhere about this module but not getting its usage.
Actually I've a file which contains some environment paths which needs to be set while running some test(say file name is SET_ENV_TOOL1.csh or SET_ENV_TOOL1.sh) with particular tools.(say TOOL1, TOOL2 etc)
SET_ENV_TOOL1.sh file conatins:
setenv UVM_HOME /u/tools/digital/uvm/uvm-1.1a
setenv VIPP_HOME /u/tools/digital/vipcat_11.30-s012-22-05-2012
setenv VIP_AXI_PATH ${VIPP_HOME}/vips/amba_axi/vr_axi/sv/ #etc.(almost 10-15 paths are need to be set like this)
Everytime while running test, tool might get changed and so environment paths also needs to set to run that tool.
I have to make a perl script which sets these paths before running test. That test will run a command and that command will use these environment paths.
Any help would be greatly appreciated. Thanks !!
Reading and changing environment variables is built-in to Perl, you do not need the modules you mentioned.
$ENV{UVM_HOME} = '/u/tools/digital/uvm/uvm-1.1a';
$ENV{VIPP_HOME} = '/u/tools/digital/vipcat_11.30-s012-22-05-2012';
$ENV{VIP_AXI_PATH} = "$ENV{VIPP_HOME}/vips/amba_axi/vr_axi/sv/";

Resources