Skip to content

Add a new SetEnvFromFile directive that reads internal environment va… - #750

Open
cisbiceanu wants to merge 1 commit into
apache:trunkfrom
cisbiceanu:mod-env-setEnvFromFile
Open

Add a new SetEnvFromFile directive that reads internal environment va…#750
cisbiceanu wants to merge 1 commit into
apache:trunkfrom
cisbiceanu:mod-env-setEnvFromFile

Conversation

@cisbiceanu

Copy link
Copy Markdown

mod_env: Add SetEnvFromFile directive

Add a new SetEnvFromFile directive that reads internal environment
variables from a file of "name=value" lines at configuration time.
Each entry is stored in the same per-directory table used by SetEnv,
so the values merge and reach r->subprocess_env identically and are
available to CGI, SSI, logging and other consumers.

The file is read once when the configuration is parsed. Blank lines
and '#' comments are ignored, surrounding whitespace is stripped, and
a line without '=' sets the variable to an empty string. Relative
paths are resolved against ServerRoot. A missing or unreadable file
fails configuration with an error, consistent with other file-backed
directives.

Because SetEnvFromFile and SetEnv write the same table, precedence
follows configuration order (last writer wins), matching existing
SetEnv semantics.

  • modules/metadata/mod_env.c: Add add_env_module_vars_from_file() and
    the SetEnvFromFile (OR_FILEINFO, TAKE1) directive.
  • docs/manual/mod/mod_env.xml: Document SetEnvFromFile.
  • CHANGES: Add entry.
  • test/pytest_suite: Add a SetEnvFromFile case to the mod_env test
    (vars.env fixture, fromfile.shtml, extra.conf.in, test_env.py).

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

…riables from a file of "name=value" lines at configuration time. Each entry is stored in the same per-directory table used by SetEnv, so the values merge and reach r->subprocess_env identically and are available to CGI, SSI, logging and other consumers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant