httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <sor...@gmail.com>
Subject Re: Get name of config file for module
Date Wed, 22 May 2013 07:40:36 GMT
On 2013-05-21 23:52, Sean Beck wrote:
> Sorin,
>
> Is there a way to figure out the name of the config file in code so I can
> log it? Or even just the path to where it is.
>
> Also, I'm confused because you said there is no such thing as a
> module-specific configuration file, but then you said configuration files
> can be split per-module. Does Apache just read out of httpd.conf on
> start-up and in httpd.conf I would use the Include directive to include my
> different configurations for each module?

Yes, exactly. Apache knows its config file, either because it's 
hard-coded when apache was compiled, or because the hard-coded path was 
overwritten by command line arguments (the -f switch). Then, the "root" 
config file, so to say, contains Include directives to other files. But 
it's only syntactic sugar for conceptually separating configurations for 
the benefit of the server administrator. Apache has no way of mapping 
the included files to modules.

I don't think there is a way to get the name of the included files. And 
I don't think there is a way either to get the name of the root 
configuration file, as far as I---briefly---looked in apache's sources.

Sorin


>
> Thanks
>
>
> On Tue, May 21, 2013 at 2:32 PM, Sorin Manolache <sorinm@gmail.com> wrote:
>
>> On 2013-05-21 21:36, Sean Beck wrote:
>>
>>> Hi all,
>>>
>>> I have written a module and now would like to log the name of the actual
>>> config file being used by the module (there will be multiple modules on
>>> the
>>> server with their own config files. I looked through
>>> https://httpd.apache.org/docs/**2.4/developer/modguide.html<https://httpd.apache.org/docs/2.4/developer/modguide.html>but
am still
>>> struggling to understand how Apache knows what the config file is for each
>>> module and how I can check what the name of the actual name of the file is
>>> for each module.
>>>
>>
>> There is no such thing as a module-specific configuration file. In
>> principle a single file could contain the configuration for all modules.
>>
>> The configuration files are split per-module for convenience only, in
>> order to be able to activate modules independently.
>>
>> The configuration _directives_ are defined per-module (but actually
>> nothing stops you from defining the same configuration directive in several
>> modules).
>>
>> Apache defines a directive called "Include". This directive allows for the
>> splitting of the entire configuration into several files. But from apache's
>> point of view there is no correspondence between the files into which the
>> configuration is split and the modules that define the directives found in
>> those files.
>>
>> Sorin
>>
>>
>


Mime
View raw message