[SR-Users] define a DBURL with SLQOPS fails

David Villasmil david.villasmil.work at gmail.com
Sat May 11 11:56:02 CEST 2019


Thanks Daniel;

The thing is I’m trying to implement password-less starts (no hardcoded
password)

So I’m querying the password on start from aws ssm and injecting it as a
define, like.

Kamailio -f kamailio.cfg -A “DBURL
`script-than-returns-MySQL-dburl-lambda.sh`“

Is it  possible to do substrdef from the command line?

Better yet, do you have a different. Approach to doing this?

David



On Sat, 11 May 2019 at 07:12, Daniel-Constantin Mierla <miconda at gmail.com>
wrote:

> Hello,
>
> use:
>
> #!substdef "!DBURL!mysql://user:password@localhost/dbname!"
>
> The define is replacing only standalone tokens, not inside string values,
> like you have for sqlcon.
>
> More docs about should be in core cookbook from wiki.
>
> Cheers,
> Daniel
> On 11.05.19 02:05, David Villasmil wrote:
>
> yes that works.
>
> My problem is not with sqlops.
>
> My problem is with the DEFINE.
>
> If I define:
>
> #!define DBURL "mysql://user:password@localhost/dbname"
>
> and later:
>
> modparam("domain", "db_url", DBURL)
>
> and then:
>
> modparam("sqlops","sqlcon","cb=>mysql://user:password@localhost/dbname")
>
> Everything works properly.
>
>
> My problem is how to use that DEFINE on ALL instances where i need to use
> it.
> i.e.
>
> #!define DBURL "mysql://user:password@localhost/dbname"
> modparam("domain", "db_url", DBURL)
> modparam("sqlops","sqlcon","cb=>mysql://user:password@localhost/dbname")
>
> works, but;
>
> #!define DBURL ©
> modparam("domain", "db_url", DBURL)
> modparam("sqlops","sqlcon","cb=>DBURL")
>
> does NOT, since
> DBURL translates "mysql://user:password@localhost/dbname" (quotes
> included)
>
> so
> modparam("sqlops","sqlcon","cb=>DBURL")
> translates into
> modparam("sqlops","sqlcon","cb=>"mysql://user:password@localhost/dbname"")
>
> and that, of course, fails.
>
>
>
>
> Regards,
>
> David Villasmil
> email: david.villasmil.work at gmail.com
> phone: +34669448337
>
>
> On Sat, May 11, 2019 at 12:59 AM Sergiu Pojoga <pojogas at gmail.com> wrote:
>
>> does is work like below? That's how mine is set, probably for the same
>> reason.
>>
>> modparam("sqlops","sqlcon","cb=>mysql://user:password@localhost/dbname")
>>
>> On Fri, May 10, 2019 at 7:47 PM David Villasmil <
>> david.villasmil.work at gmail.com> wrote:
>>
>>> No,
>>>
>>> DBURL translates into
>>>
>>> "mysql://user:admin@dbuser/dbname"
>>>
>>> so in sqlops:
>>>
>>> modparam("sqlops","sqlcon","cb=>DBURL")
>>>
>>> translates into:
>>>
>>> modparam("sqlops","sqlcon","cb=>"mysql://user:admin@dbuser/dbname"")
>>>
>>> that works great on
>>>
>>> modparam("domain", "db_url", DBURL)
>>>
>>> because it translates into:
>>>
>>> modparam("domain", "db_url", "mysql://user:admin@dbuser/dbname")
>>>
>>>
>>>
>>> But not on the sqlops case
>>>
>>> Regards,
>>>
>>> David Villasmil
>>> email: david.villasmil.work at gmail.com
>>> phone: +34669448337
>>>
>>>
>>> On Sat, May 11, 2019 at 12:32 AM Sergiu Pojoga <pojogas at gmail.com>
>>> wrote:
>>>
>>>> You've got a typo
>>>>
>>>> modparam("sqlops","sqlcon","cb=>DBURL")
>>>>
>>>> On Fri, May 10, 2019 at 7:02 PM David Villasmil <
>>>> david.villasmil.work at gmail.com> wrote:
>>>>
>>>>> Hello guys,
>>>>>
>>>>> So, i'm defining:
>>>>>
>>>>> DBURL "mysql://user:password@dbhost/dbname"
>>>>>
>>>>> and later on...
>>>>>
>>>>> modparam("sqlops","sqlcon","cb=>"DBURL)
>>>>>
>>>>> and this fails miserably..
>>>>>
>>>>> What do do on this case?
>>>>>
>>>>>
>>>>> Thanks all!
>>>>>
>>>>> Regards,
>>>>>
>>>>> David Villasmil
>>>>> email: david.villasmil.work at gmail.com
>>>>> phone: +34669448337
>>>>> _______________________________________________
>>>>> Kamailio (SER) - Users Mailing List
>>>>> sr-users at lists.kamailio.org
>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>
>>>> _______________________________________________
>>>> Kamailio (SER) - Users Mailing List
>>>> sr-users at lists.kamailio.org
>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing List
>>> sr-users at lists.kamailio.org
>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
>
> --
Regards,

David Villasmil
email: david.villasmil.work at gmail.com
phone: +34669448337
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190511/dd5a28b0/attachment.html>


More information about the sr-users mailing list