[OpenSIPS-Devel] [ opensips-Patches-3513177 ] Substitutions in configuration file

Bogdan-Andrei Iancu bogdan at opensips.org
Mon Apr 2 17:41:29 CEST 2012


Hi Nick,

On 03/30/2012 05:22 PM, Nick Altmann wrote:
> I'm not agree with you, because I use m4 now.
>
> Such functionality was really useful together with include functionality.
> For example, when I have errors with m4 it's hard to understand in
> what line these errors occurred.
Why that ? IMHO, even if the script was generated via M4, even if the 
"replacement" is done internally, you have exactly the same issues - if 
you use replacements with multiple lines.

Actually with m4 is even better, as you see the intermediary script 
version (you also see the script with all text processing done), so it 
easy to spot errors.
> m4 is not always convenient,
> I should compile my configuration every time,
personally, I simply add it my "init.d" script, so the .cfg is 
automatically built when "start" is done.
>   but I don't need all
> power of m4, I need only substitutions.
> m4 is not a panacea for all occasions.
Ok, it may be the case - on the other hand, using the over-powered tool 
of M4 comes with no penalty ....and M4 is by default installed on all 
distros..


This is my personal opinion on this.

Regards,
Bogdan


> --
> Nick
>
>
> 2012/3/30 SourceForge.net<noreply at sourceforge.net>:
>> Patches item #3513177, was opened at 2012-03-30 03:26
>> Message generated for change (Comment added) made by vladut-paiu
>> You can respond by visiting:
>> https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3513177&group_id=232389
>>
>> Please note that this message will contain a full copy of the comment thread,
>> including the initial issue submission, for this request,
>> not just the latest update.
>> Category: core
>> Group: trunk
>>> Status: Closed
>>> Resolution: Rejected
>> Priority: 5
>> Private: No
>> Submitted By: Nick Altmann (nikbyte)
>>> Assigned to: Vladut-Stefan Paiu (vladut-paiu)
>> Summary: Substitutions in configuration file
>>
>> Initial Comment:
>> This patch gives very useful feature - support to perform substitutions inside the strings of config.
>> Work derived from the great parser enhancements made by Daniel-Constantin Mierla to the sip-router project.
>>
>> For example
>>
>> !subst
>> perform substitutions inside the strings of config
>> !subst offers an easy way to search and replace inside strings before cfg parsing. E.g.,:
>> !subst "/regexp/subst/flags"
>> flags is optional and can be: 'i' - ignore case; 'g' - global replacement
>> Example:
>> !subst "/DBPASSWD/xyz/"
>> modparam("acc", "db_url", "mysql://user:DBPASSWD@localhost/db")
>> will do the substitution of db password in db_url parameter value
>>
>>
>> ----------------------------------------------------------------------
>>
>>> Comment By: Vladut-Stefan Paiu (vladut-paiu)
>> Date: 2012-03-30 07:11
>>
>> Message:
>> Hello,
>>
>> We do not feel such a patch would be very useful.
>> You can always implement such functionality with a more advanced tool, like
>> m4, instead of implementing all of this subst logic into the OpenSIPS
>> parser.
>>
>> Regards,
>> Vlad
>>
>> ----------------------------------------------------------------------
>>
>> You can respond by visiting:
>> https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3513177&group_id=232389
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>


-- 
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com




More information about the Devel mailing list