Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Switching Between Development and Production Environments

by freddo411 (Chaplain)
on Oct 06, 2003 at 17:29 UTC ( [id://297009]=note: print w/replies, xml ) Need Help??


in reply to Switching Between Development and Production Environments

On my project I maintain a small "config" file that contains all variables that have unique values based on the hostname that the script is running on. Examples are: the path to ORACLE_HOME, etc. etc.

To keep things organized, don't put anything else in this file.

Care must be taken when switching from dev to production to use the "correct" config file. One trick to help with this is to name the config files like "<hostname>.config" and have the parent code read in $hostname.config

I have a very simple parsing routine that reads each line in the config file, ignores comments lines, and sets a name value pair in a hash. I also set some needed ENV vars too.

In my code I use the values like so:

my $localvar = $CONFIG{'TEMP_DIR'};

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday

Replies are listed 'Best First'.
Re: Re: Switching Between Development and Production Environments
by zby (Vicar) on Oct 07, 2003 at 08:34 UTC
    Why not make a switch in the config file like:
    if(`hostname` eq 'athena'){ # or ($^O =~ /win/i) $tempdir = '/usr/tmp'; }else{ $tempdir = '/tmp'; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://297009]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-19 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found