variable scopes only for one virtual sever or one request
Hello.
I want to operate multiple stage environments(development, staging, production) in a partition.
For those environments, I want to use same aflex policies as many as possible.
I had looked for use following aflex policies.
staging_env.tcl
production_env.tcl
http_location.tcl
But ::global:: variables seem really global on the whole AX device.
So I think the variable for the staging effects to the production.
I want to use variables can be applied to one virtual service or one request.
Do we have any solutions?
I want to operate multiple stage environments(development, staging, production) in a partition.
For those environments, I want to use same aflex policies as many as possible.
I had looked for use following aflex policies.
staging_env.tcl
when RULE_INIT { set ::global::target_service = "staging_service_80" }
production_env.tcl
when RULE_INIT { set ::global::target_service = "production_service_80" }
http_location.tcl
when HTTP_REQUEST { pool ::global::target_service }
But ::global:: variables seem really global on the whole AX device.
So I think the variable for the staging effects to the production.
I want to use variables can be applied to one virtual service or one request.
Do we have any solutions?
Tagged:
0
Comments
Just do ::target_service and it will be "local" to the Virtual Port.
Thank you for your response.
I have just tried but result is NG.
:: variable can not be read by other policies.
I want to use separated policies to keep maintainability.
config for a virtual service aflex test-env
aflex test-access
log(result) : logged only for the global variable
I rechecked the manual 'aFleX Scripting Language Reference'
and some descriptions there. any ideas?
Using tables for example will give you the same result as ::global::.
The only alternative would be to include the RULE_INIT in the actual script.
I found a trick as follows.
When the virtual server works on 10.0.0.1.
aflex test-env
aflex test-access
log
We might use arrays in this way.
Please tell me if you have any smarter ways.