On 9/16/22 06:30, Hildegard Meier wrote:
Squid currently only supports three kinds of conditions: true, false, and integer equality comparison (as documented).
I think it would be very good to give some concrete examples of how one can use the if-condition.
I agree.
For now, your best option is probably to post-process the versioned configuration to substitute your own custom macro(s). For example, your Squid startup (or deployment) stript can substitute a ${mynamespace:PeerName} macro in squid.conf.template with either true or false, depending on the node, producing squid.conf that Squid can use: cache_peer ${mynamespace:PeerName} sibling 3128 3130 If you need to hard-code peer names or substantially different configurations for individual cache peers, then you can do something like this in the template configuration file: if ${mynamespace:AtNode1()} cache_peer node2.example.com sibling 3128 3130 endif if ${mynamespace:AtNode2()} cache_peer node1.example.com sibling 3128 3130 endif
Sorry, I do not understand what you write.
It is difficult for me to improve the above without knowing which parts are unclear to you, but I will try: The above snippets are concrete examples of how one can use conditional statements (with custom macros) in a squid.conf template. Your custom program will take a squid.conf.template containing one of the above snippet and substitute the above ${...} custom macros with appropriate values.
On node1, the first template snippet will be replaced with cache_peer node2.example.com sibling 3128 3130 On node2, the first template snippet will be replaced with cache_peer node1.example.com sibling 3128 3130 On node1, the second template snippet will be replaced with if true cache_peer node2.example.com sibling 3128 3130 endif if false cache_peer node1.example.com sibling 3128 3130 endif HTH, Alex. _______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users