I did a simple tweak to the configuration file management so environment variables could be substituted into configuration files. All I added to MyApp.pm was:

__PACKAGE__->config('Plugin::ConfigLoader' =>
   {    file => 'MyApp.yaml',
        substitutions => {
           ENV => sub {
               my ($c, $v) = @_;
               if (! defined($ENV{$v})) {
                   die("Missing environment variable: $v");
               } else {
                   return $ENV{$v};
               }
           }
        }
   }
);

Then, I could use YAML settings like:

session:
 storage:       '__ENV(TEMP)__/sessions'

It was pretty easy for us to get web servers to set environment variables, so this trick allowed us to have multiple systems with different database and file directories set pretty straightforwardly.

This may be one approach you could use, but there are likely better ones. Especially since I'm still stuck at 5.70 waiting for a good opportunity to upgrade without anyone (even my colleagues) noticing. This is a 5.70 solution, but should be OK in 5.80, I would guess.

All the best
Stuart


Stephen Clouse wrote:
Hello all,

I am fairly new to Catalyst and am currently evaluating it for use on several projects, a couple of them being conversions of an existing system to use Catalyst instead of the hacked-together in-house framework currently in use. Those apps have the old per-customer/mass-blog-hosting model going -- the exact same app deployed with different database/filesystem path configurations (currently set using mod_perl configuration directives inside <VirtualHost> sections in Apache config), previously accomplished with Catalyst either with FastCGI deployment or ACCEPT_CONTEXT magic that I don't quite understand yet.

I have seen hints dropped in places such as http://osdir.com/ml/lang.perl.modules.dbix-class/2006-08/msg00188.html that Catalyst 5.80 has gained more explicit support for such a deployment model under mod_perl, but so far I have come up empty on finding references or examples of how to actually do it.

Some guidance would be greatly appreciated.

--
Stephen Clouse <stephenclo...@gmail.com <mailto:stephenclo...@gmail.com>>

--
This message was scanned by ESVA and is believed to be clean.
Click here to report this message as spam. <http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=64AE2280C1.6F32B>
------------------------------------------------------------------------

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

--
Stuart Watt
ARM Product Developer
Information Balance
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to