From: Chris W. <ch...@an...> - 2010-03-02 22:06:11
|
Thanks for the quick response. Already got a select-list displayed with a list of the defined virtual hosts. It's easy when you know how! Chris On 02.03.10 22:03, Jamie Cameron wrote: > On 02/Mar/2010 11:35 Chris Wik <ch...@an...> wrote .. >> I've written a module for managing multiple installations of Lasso >> Server 9 (www.lassosoft.com) >> >> Lasso Server integrates with Apache via FastCGI >> >> I would like my module to be able to insert an Include directive into a >> selected virtual host in order to allow that virtual host to hand off >> requests for .lasso files to an instance of Lasso Server >> >> Is there an easy way to do this by utilising the existing functions in >> the Apache module? Or would I have to write my own code to parse the >> virtual host entry and insert the directive? > > Yes, absolutely - you can use code like this : > > foreign_require("apache"); > $conf = apache::get_config(); > @vhosts = apache::find_directive_struct("VirtualHost", $conf); > foreach $v (@vhosts) { > $sn = apache::find_directive("ServerName", $v->{'members'}); > if ($sn eq "whatever.com") { > @includes = apache::find_directive("Include", $v->{'members'}); > push(@includes, "/path/to/file.lasso"); > apache::save_directive("Include", \@includes, $v->{'members'}, $conf); > flush_file_lines($v->{'file'}); > } > } > > - Jamie -- Chris Wik Anu Internet Services Ltd |