reading apache configuration via mod_perl
reading apache configuration via mod_perl
am 23.10.2008 20:55:14 von Adam Prime
At $work we have a situation where large chunks of configuration are
being created with PerlSections, in combonation with mod_macro. There
is a desire to see what exactly that all get mapped to in a more
traditional Apache configuration like style. PerlSections->dump kind of
does what we want, except that it doesn't expand the macro's that are
used. mod_info also has the same sort of problem.
Is it theoretically possible to actually generate something like that?
I imagine that you'd have to somehow get at the actual data structures
that the server creates to represent the parsed configuration and then
somehow turn that back into something human readable.
Any ideas?
Adam
Re: reading apache configuration via mod_perl
am 23.10.2008 21:00:35 von mpeters
Adam Prime wrote:
> Is it theoretically possible to actually generate something like that?
> Any ideas?
I'm definitely ignorant enought about Apache's internals to be able to answer that question. And the
following doesn't really answer your question, but this is how we handle having a dynamic config
while still being able to see what it looks like. We use a template. We have a wrapper script around
Apache that queries the database and config files and then starts Apache pointing to the generated
conf file. This gives us the benefit of a data driven config but we still get a real config file out
of it that we can inspect.
--
Michael Peters
Plus Three, LP
Re: reading apache configuration via mod_perl
am 23.10.2008 21:15:15 von Adam Prime
Michael Peters wrote:
> Adam Prime wrote:
>
>> Is it theoretically possible to actually generate something like that?
> > Any ideas?
>
> I'm definitely ignorant enought about Apache's internals to be able to
> answer that question. And the following doesn't really answer your
> question, but this is how we handle having a dynamic config while
> still being able to see what it looks like. We use a template. We have
> a wrapper script around Apache that queries the database and config
> files and then starts Apache pointing to the generated conf file. This
> gives us the benefit of a data driven config but we still get a real
> config file out of it that we can inspect.
>
I suggested this when I started here, but we were already too committed
to PerlSections at that point. I don't think that that's likely to
change but it is an option to be considered though if we have to
refactor. If we were starting this now, I would definitely favor doing
it that way.
Adam
Re: reading apache configuration via mod_perl
am 23.10.2008 21:22:26 von Perrin Harkins
On Thu, Oct 23, 2008 at 2:55 PM, Adam Prime wrote:
> PerlSections->dump kind of does what we want,
> except that it doesn't expand the macro's that are used.
This may be obvious in hindsight, but using mod_macro was probably a
bad idea. I'd suggest using perl to handle what you were doing with
mod_macro. Actually, I'd suggest staying far away from PerlSections
and doing a templated conf file as Michael recommend, but that may too
much to change all at once.
- Perrin
Re: reading apache configuration via mod_perl
am 23.10.2008 21:23:53 von Perrin Harkins
On Thu, Oct 23, 2008 at 3:22 PM, Perrin Harkins wrote:
> On Thu, Oct 23, 2008 at 2:55 PM, Adam Prime wrote:
>> PerlSections->dump kind of does what we want,
>> except that it doesn't expand the macro's that are used.
>
> This may be obvious in hindsight, but using mod_macro was probably a
> bad idea. I'd suggest using perl to handle what you were doing with
> mod_macro. Actually, I'd suggest staying far away from PerlSections
> and doing a templated conf file as Michael recommend, but that may too
> much to change all at once.
On second though, before you do anything else, ask the mod_macro
people how they deal with this. They must get this question a dozen
times a day.
- Perrin
Re: reading apache configuration via mod_perl
am 23.10.2008 21:33:26 von Adam Prime
Perrin Harkins wrote:
> On Thu, Oct 23, 2008 at 3:22 PM, Perrin Harkins wrote:
>
>> On Thu, Oct 23, 2008 at 2:55 PM, Adam Prime wrote:
>>
>>> PerlSections->dump kind of does what we want,
>>> except that it doesn't expand the macro's that are used.
>>>
>> This may be obvious in hindsight, but using mod_macro was probably a
>> bad idea. I'd suggest using perl to handle what you were doing with
>> mod_macro. Actually, I'd suggest staying far away from PerlSections
>> and doing a templated conf file as Michael recommend, but that may too
>> much to change all at once.
>>
>
> On second though, before you do anything else, ask the mod_macro
> people how they deal with this. They must get this question a dozen
> times a day.
>
> - Perrin
>
Good idea. I'm pretty sure they are just going to tell us to use
mod_info though, which unfortunately doesn't play well at all with
mod_perl's PerlSections, but i've asked anyway.
Adam