Is there any mechanism in the Apache httpd framework that would allow me to pass custom parameters from the Apache configuration file to a custom Apache module (written using the C API)? I really only need key/value pairs.
Something like in conf file:
ConfigParameter foo bar
And then in the code:
string foo = GetApacheConfigParameter("foo"); // = "bar"
No; not directly. A dirty hack would be
in the config file – and a
in your module. Anything beyond that requires the use of a proper structure on a per directory, server, etc. Normally that structure would contain a lot of specific things. In your case it would just be a single table.
So somewhat clean way would be to simply use a table – and leave it at that:
and then, everywhere where you want to use this do:
or
depending on where it us used – and then use:
or similar. See mod_example_hooks and the various our_* calls to get a pointer. Above example leaves out configs on server level and merging of configs. Add those if you need them – there is a corresponding merge call for tables. mod_alias.c et.al. have good examples.