.TH "md_src_libgetenv_README" 3elektra "Sun May 29 2016" "Version 0.8.14" "Elektra" \" -*- nroff -*- .ad l .nh .SH NAME md_src_libgetenv_README \- README .IP "\(bu" 2 infos = Information about elektrify getenv below .IP "\(bu" 2 infos/author = Markus Raab elektra@libelektra.org .IP "\(bu" 2 infos/description = .PP .PP .SH "kdb-elektrify-getenv(1) -- elektrify the environment of applications " .PP .PP \fCkdb elektrify-getenv\fP .PP .SS "DESCRIPTION" .PP When an application is elektrified using libelektragetenv, it does not only request \fCenviron\fP, but also Elektra for every getenv(3) and secure_getenv(3) library call\&. .PP Its main purpose is to: .PP .IP "\(bu" 2 have standard ways to modify the environment .IP "\(bu" 2 make relogin (or even restart!) of applications unnecessary .IP "\(bu" 2 allow a hierarchical structure for environment .IP "\(bu" 2 allow settings to only apply for individual applications or only in special context .IP "\(bu" 2 still preserve the advantages (inheriting of environment to subprocesses) .IP "\(bu" 2 Availability in at, cron and similar scripts\&. .PP .PP It is implemented using a LD_PRELOAD technique, see \fBUSAGE\fP below for global activation\&. .PP .SS "LOOKUPS" .PP The main purpose of this approach is to finally have a well-defined way to set and get environment variables\&. Elektra's variables will be in use immediately for every newly started application (no relogin necessary)\&. .PP To do so, getenv(3) will lookup multiple sources next to searching in the environment (environ)\&. As running example will use \fCgetenv('HOME') -> /path/to/home\fP: .PP .IP "1." 4 Given commandline parameters will always be preferred (see \fBOPTIONS\fP below)\&. .PP E\&.g\&. \fCkdb elektrify-getenv --elektra:HOME=/path/to/home\fP .IP "2." 4 Then \fC/env/override/\fP will be looked up, where is the parameter to \fCgetenv\fP\&. If found, the key will be returned, if it is a null keys, \fCgetenv\fP will return \fCNULL\fP\&. .PP E\&.g\&. \fCkdb set user/env/override/HOME /path/to/home\fP .IP "3." 4 Then environment will be requested\&. .PP E\&.g\&. \fCHOME=/path/to/home kdb elektrify-getenv \fP .PP .IP "3." 4 Then \fC/env/fallback/\fP will be looked up\&. If found, the key will be returned, if it is a null keys, \fCgetenv\fP will return \fCNULL\fP\&. .PP E\&.g\&. \fCkdb set user/env/fallback/HOME /path/to/home\fP .PP .PP .SS "OPTIONS" .PP When \fCelektrify-getenv\fP is active, every application additionally accepts Elektra's getenv options\&. Interleaving Elektra's and the application's options is allowed\&. Elektra will parse its options (starting with --elektra) first and discard them before the other application is started\&. Therefore the application will not see that they even existed, e\&.g\&.: given \fCkdb elektrify-getenv -V --elektra-debug -L\fP the application will be called with \fC -V -L\fP\&. .PP .SS "Internal Options" .PP .IP "\(bu" 2 \fC--elektra-help\fP: Outputs this help\&. .IP "\(bu" 2 \fC--elektra-version\fP: Gives version information\&. .IP "\(bu" 2 \fC--elektra-debug=file\fP, \fCELEKTRA_DEBUG\fP or \fC/env/option/debug\fP: Trace all getenv(3) calls to a file\&. stderr if no file is given, e\&.g\&. \fCkdb set user/env/option/debug ''\fP\&. Note that null values (no forth argument), will disable debug messages\&. See examples below\&. .IP "\(bu" 2 \fC--elektra-clearenv\fP, \fCELEKTRA_CLEARENV\fP or \fC/env/option/clearenv\fP: Call clearenv(3) before entering main\&. This is a recommended security feature\&. Elektra itself, if configured that way, will still be able to use the environment\&. .IP "\(bu" 2 \fC--elektra-reload-timeout=time_in_ms\fP, \fCELEKTRA_RELOAD_TIMEOUT\fP or \fC/env/option/reload_timeout\fP: Activate a timeout based feature when a time is given in ms (and is not 0)\&. .PP .PP Internal Options are available in three different variants: .PP .IP "1." 4 as commandline parameter: \fC--elektra-