Re: disappearing configuration items in unlang
Alan DeKok <aland@deployingradius.com> wrote
Hugh Messenger wrote:
If I wrap an 'if' statement round something (in this case a query in mysql_dialup.conf), any config items seem to get blown away.
You can't. "if" is a processing directive that is valid only when packets are being processed. The configuration items are parsed once when the server starts, and don't change after that.
So for instance:
It would be very nice to be able to do that, but it would also be very difficult to implement.
It would be very nice, and very intuitive. How hard would it be to just provide that one simple construct ("if <config item related condition> {}") during parsing of the startup config? No need for the whole of unlang. More of an 'ifdef' style pre-processing directive than an integrated part of the language. I know you have bigger fish to fry at the moment, just a thought for the future.
The solution is to add a layer of indirection:
authorize_reply_query = "%{control:Tmp-String-0}"
Then, while processing the request, set:
update control { Tmp-String-0 = "..." }
That *should* work, I think.
I'll let you know.
Alan DeKok.
-- hugh
Hugh Messenger wrote:
It would be very nice, and very intuitive. How hard would it be to just provide that one simple construct ("if <config item related condition> {}") during parsing of the startup config?
Extremely difficult, unfortunately. The problem is that the config assignments are static: "foo = bar". The variable "foo" in a module gets given value "bar". Changing that to *dynamic* variables means that every single assignment has to be wrapped with "process language stuff". That's hard.
No need for the whole of unlang. More of an 'ifdef' style pre-processing directive than an integrated part of the language.
It's much easier to integrate everything, honestly. Alan DeKok.
participants (2)
-
Alan DeKok -
Hugh Messenger