Apache::EnvDir - Dynamically set environment variables via a directory of files
httpd.conf:
PerlModule Apache::EnvDir PerlPostReadRequestHandler Apache::EnvDir EnvDir /path/to/dir/of/files PREFIX
Apache::EnvDir creates environment variables using a directory of files. The environment is dynamic -- changes to the files are reflected immediately within Apache -- which allows data to be passed into the Apache environment without restarting the webserver.
The module should be installed as a PostReadRequest handler to allow its changes to be seen by other modules such as mod_cgi and mod_include.
Apart from installing the module, loading it into mod_perl, and registering it as a handler, there is only one configuration option
This directive takes either one or two arguments. The first argument is always a directory path (either absolute or relative to ServerRoot). Any files found in this directory will be turned into environment variables. The filename (minus any directory information) will become the variable name and the contents of the file become the value of the variable.
If EnvDir is called with two arguments, the second argument is used as a variable name prefix and will be prepended to the filename when constructing the environment variable name.
EnvDir /path/to/dir FOO_
If /path/to/dir contains a file named BAR, an environment variable named FOO_BAR will be created within Apache. The contents of FOO_BAR will be the contents of the file BAR. If BAR's contents change while Apache is running, the contents of FOO_BAR will change as well.
If a file is added to the directory, a new variable is immediately created. If a file is removed, the variable will be removed.
This is alpha software, and as such has not been tested on multiple platforms or environments. This version of Apache::EnvDir requires Apache 1.3 and mod_perl. It does not currently run in Apache 2 or mod_perl 2.
perl(1), mod_perl(3), Apache(3), mod_env
Michael Cramer <cramer@webkist.com>
Copyright (c) 2003, Michael Cramer All rights reserved.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
To install Apache::EnvDir, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::EnvDir
CPAN shell
perl -MCPAN -e shell install Apache::EnvDir
For more information on module installation, please visit the detailed CPAN module installation guide.