[asterisk-dev] [Code Review] Add #includeif statement
Paul Belanger
pabelanger at digium.com
Wed Oct 5 09:32:09 CDT 2011
On 11-10-05 10:21 AM, Jason Parker wrote:
> On 10/04/2011 07:47 PM, Matt Riddell wrote:
>> What was the original reason that #include started blocking the loading of
>> modules when the included file was missing? I've always hated that.
>>
>
> Take the following config setup as an example.
>
> sip.conf:
> #include mypeer.conf
> #include yourpeer.conf
>
> mypeer.conf:
> [mypeer]
> type=peer
> host=10.0.0.2
> #include mypeer-secret.conf
>
> yourpeer.conf:
> [yourpeer]
> type=peer
> host=10.0.0.3
> #include yourpeer-secret.conf
>
> myypeer-secret.conf:
> secret=applesauce
>
> yourpeer-secret.conf:
> secret=embiggen
>
>
> The astute may have noticed that there is a typo in the mypeer-secret.conf.
> What would happen if we allowed the config parser to continue? Very bad things.
>
> This is just one of several scenarios that I could think of. It makes a lot of
> sense to me that if somebody uses a #include, then they absolutely must have
> that file - even if it's empty.
>
Right, and this approach for #include is fine to be honest. I don't
think I would suggest changing that functionality. However, if you rely
a lot on include files for your asterisk setup, something we currently
do with the test-suite, having a lot of empty files lying around
clutters up the file system.
One of the main reasons #includeif / #sinclude is being suggested is to
help an administrator, who understands the differences between the two,
cut down on the amount of files that needs to be managed (even if they
are empty).
--
Paul Belanger
Digium, Inc. | Software Developer
twitter: pabelanger | IRC: pabelanger (Freenode)
Check us out at: http://digium.com & http://asterisk.org
More information about the asterisk-dev
mailing list