cbrandtbuffalo has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed Monks,
We support some fairly complex web applications and lately we're running into some issues with our config infrastructure. I got some help recently when I asked What config info belongs where for web apps?; thanks to those who responded.
Now I'm trying to define a better config system, but I can't find any best practices or guidelines beyond simple config file processing.
Here are my needs:
Here's a draft of a best practice (untested), with many questions:
### Shared config info -- "machine scope" ### # A local module that loads the shared config info. # Is there a way to pass in a project name in a 'use' # that is mod_perl safe? use My::LocalConfig qw(project_name); ### App-specific config info -- "machine scope" ### # Assuming 'config_path' is a function exported by the LocalConfig mod +ule. # Or should it just set a variable? # What sort of variable and where can it be set so it's ready when # the require runs? # Would a 'do' be better? # Should the project_name be passed in here as a parameter? require config_path . "/my_config.pl"; # Or should we use a Config module here? # Do various config modules allow a function call when you set # the path? # Are there Config modules that allow some logic in them? # We have several cases where we set # variables differently based on dev, QA, or prod environments. ### Session config info -- "session scope" ### # A module that just grabs relevant $ENV info and # provides it via a method or methods. use My::SessionConfig; # then my $session = My::SessionConfig->new(); my $current_userid = $session->current_user();
What are you doing for your config environment?
Do you have custom modules to handle all of this?
Once I nail down the best practice or a functioning system, I'd like to follow some of TheDamian's advice and hide a bunch of this to make it easier to use. But we've already been burned by some cleverness in our mod_perl environment, so I'll want to be careful.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Configuration Best Practices for Web Apps
by perrin (Chancellor) on Jan 24, 2006 at 17:55 UTC | |
by cbrandtbuffalo (Deacon) on Jan 30, 2006 at 19:09 UTC | |
by perrin (Chancellor) on Jan 30, 2006 at 21:13 UTC | |
Re: Configuration Best Practices for Web Apps
by clinton (Priest) on Jan 24, 2006 at 18:40 UTC | |
Re: Configuration Best Practices for Web Apps
by dragonchild (Archbishop) on Jan 24, 2006 at 17:08 UTC | |
Re: Configuration Best Practices for Web Apps
by thedoe (Monk) on Jan 24, 2006 at 17:30 UTC |