[sr-dev] [kamailio/kamailio] Cannot use environment variables in modparam() function (#2276)
Mathias Brodala
notifications at github.com
Mon Apr 27 15:10:25 CEST 2020
I finally got around to test this but it seems I'm doing something wrong:
```
#!substdef "/DBRWUSER/$env(DBRWUSER)/g"
#!substdef "/DBRWPW/$env(DBRWPW)/g"
#!substdef "/DBHOST/$env(DBHOST)/g"
#!substdef "/DBNAME/$env(DBNAME)/g"
#!define DBURL "mysql://DBRWUSER:DBRWPW@DBHOST/DBNAME"
```
Now trying to start Kamailio (5.3.3 as suggested) fails:
```
kamailio_1 | 0(1) ERROR: <core> [core/pvapi.c:923]: pv_parse_spec2(): error searching pvar "env"
kamailio_1 | 0(1) ERROR: <core> [core/pvapi.c:1126]: pv_parse_spec2(): wrong char [D/68] in [$env(DBRWUSER)/g] at [5 (5)]
kamailio_1 | 0(1) ERROR: <core> [core/re.c:170]: parse_repl(): bad specifier in replace part /$env(DBRWUSER)/g
kamailio_1 | 0(1) ERROR: <core> [core/ppcfg.c:69]: pp_subst_add(): bad subst expression: /DBRWUSER/$env(DBRWUSER)/g
kamailio_1 | 0(1) ERROR: <core> [core/ppcfg.c:96]: pp_substdef_add(): subst rule cannot be added
```
I also tried the following but it doesn't make a difference:
```
#!substdef "!DBURL!mysql://$env(DBRWUSER):$env(DBRWPW)@$env(DBHOST)/$env(DBNAME)!"
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2276#issuecomment-619975406
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20200427/45bc8ec1/attachment.html>
More information about the sr-dev
mailing list