Re: #include?

From: Manuel Soto <manuelsspace-listas#yahoo.com>
Date: Fri, 30 May 2008 10:59:29 -0430


2008/5/30 Willy Tarreau <w#1wt.eu>:
> Hi guys,
>
> On Fri, May 30, 2008 at 12:10:23AM +0200, Krzysztof Oledzki wrote:
>>
>>
>> On Thu, 29 May 2008, Dan Zubey wrote:
>>
>> >Willy, would it be possible to add the directive 'include' to have the
>> >pre-processor include another config file from the local filesystem?
>> >i.e.,
>> >
>> >option include /etc/haproxy/backend.conf
>>
>> Not yet. BTW: this "option" is IMHO misused here.
>
> agreed. I think that we should use the "include" directive alone at the
> beginning of a line without any "option". It should not change the current
> context. For instance :
>
> frontend foobar
> bind xxx
> include foobar-deny.acl
> include foobar-rules.acl
> default_backend xxx
>
> where "foobar-deny" will contain a lot of blacklist rules, and "foobar-rules"
> will contain acl+use_backend rules for this frontend.
>
>> >It would help immensely to make things more readable for my coworkers :)
>> >
>> >I know I could write a pre-preprocessor to make a config file, just
>> >wondering if we could have it in haproxy.
>>
>> It is on my TODO list, unfortunately it has a very low priority as my
>> configs are automatically generated so I have nearly no motivation to pick
>> it up.
>
> same here, TODO+low_prio+low_motivation :-)
>
>> So, if you really need this functionality you may try to code it yourself
>> or find someone to do it. Or maybe someone else is working on this
>> feature?
>
> It would be good. BTW if you happen to work on this, as Krzysztof said, take
> care of the file names and line numbers when reporting perse errors. We need
> to get the whole call stack. And we need to limit the include depth in order
> to prevent infinite loops.
>
> regards,
> Willy
>
>
>

You may use cpp in your start control shell to generate the final config each time and start haproxy using the parsed config file

This will allow you to use include, define, if/else, and inline parametrized functions

Later,
Manuel Soto Received on 2008/05/30 17:29

This archive was generated by hypermail 2.2.0 : 2008/05/30 17:46 CEST