[Catalyst] Best place to set environment variables

John Napiorkowski jjn1056 at yahoo.com
Wed Oct 11 16:06:27 CEST 2006


-- Marc Logghe <Marc.Logghe at DEVGEN.com> wrote:

> Hi,
> What is The Best Way (TM) to configure environment
> variables in Catalyst
> ?
>  
> Currently, it is set in a perl block in the apache
> perl.conf
> $ENV{ORACLE_HOME} = '/path/to/orahome/';
>  
> But actually I'd prefer to keep this together with
> the configuration of
> the catalyst application itself.
> Is it possible to do that in the application yml,
> for instance ? 

I don't know about putting it into the config but the
way I do this is I have some batch scripts to start
and restart the servers that are part of my
application. Since I have several it's handy.  So I
have three batch scripts, one for development and one
for testing and a common one.  When I have production
I'll have another:

Here's the Development script:

#!/bin/bash

echo setting up enviroment

export REPORTING_BASE=/publish/staff/johnn/reporting
export REPORTING_HOST=http://ny444-linuxdev1.nymag.biz

echo setting the local prefix for configuration
export REPORTING_CONFIG_LOCAL_SUFFIX=development

export REPORTING_PORT=8012

echo running startup script

./startup.sh


The "REPORTING_CONFIG_LOCAL_SUFFIX" is so that I can
have a common yml file and then seperate configs for
development and testing.  So I have both
"reporting.yml" and "reporting_development.yml"  There
is also a "reporting_test.yml" which has the different
database connection from development

This batch runns the common batch file, "startup.sh"

#!/bin/bash

echo setting up the hostname configuration
export
NYMAG_REPORTING_SERVER=http://$REPORTING_BASE:$REPORTING_PORT

echo setting up PERL5LIB path
export PERL5LIB=$REPORTING_BASE/lib

echo Starting the services server
$REPORTING_BASE/reporting/script/reporting_server.pl
-p $REPORTING_PORT -f -r -k &

echo all finished

This way I can control the perl path for classes that
are common to lots of projects.

Seems if your oracle stuff is specific to the server
(dev, test) you could put in in the
startup_development script and isolate it for when you
promote to production.

I have this working with the test server on apache,
there is just a check to see which engine to load.

I put this all in a /admin/bin directory global to my
catalyst applications;

/admin
  /bin
/lib
/reporting (catalyst root)
/feeder (catalust root)

etc.
--john
>  
> Cheers,
> Marc
> > _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Catalyst mailing list