Correct Syntax for $conf to populate Varnish Control Terminal
-
22-10-2019 - |
Pergunta
This may be more a php question, but pertains to Drupal, so here goes: I'm trying to configure Varnish Control Terminal to use multiple hosts using settings.php
. I have:
$conf['varnish_control_terminal'] = array ('11.22.33.44:6082','22.33.44.55:6082');
but I keep getting this error (1 set for each host in the array) at http://localhost/admin/config/development/varnish:
Warning: explode() expects parameter 2 to be string, array given in _varnish_terminal_run() (line 192 of /app/aegir/platforms/cms-1.0/sites/all/modules/contrib/varnish/varnish.module).
Warning: Invalid argument supplied for foreach() in _varnish_terminal_run() (line 196 of /app/aegir/platforms/cms-1.0/sites/all/modules/contrib/varnish/varnish.module).
I've also tried these (one by one):
$conf['varnish_control_terminal'] = array ('11.22.33.44:6082 22.33.44.55:6082');
$conf['varnish_control_terminal'] = array (11.22.33.44:6082 22.33.44.55:6082);
$conf['varnish_control_terminal'] = array ('11.22.33.44:6082');
with the same result. I think my array
syntax is incorrect, but I am not sure what the correct syntax would is ... any ideas ... ? I looked at php's array documentation as well.
EDIT: This also causes the varnish status at http://localhost/admin/reports/varnish to go blank, so I am not sure if Varnish caching for Drupal is functioning properly or not at all.
Many thanks!
PS: I also posted a note in the Varnish project's issue queue on Nov 30th and haven't heard anything.
Solução
So, turns out, the list of hosts is not an array; this works:
$conf['varnish_control_terminal'] = '11.22.33.44:6082 22.33.44.55:6082';
Hopefully, it helps someone else.