Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Configuration Best Practices for Web Apps

by thedoe (Monk)
on Jan 24, 2006 at 17:30 UTC ( #525252=note: print w/replies, xml ) Need Help??

in reply to Configuration Best Practices for Web Apps

  • be able to load shared config info that is machine-specific but relevant across many apps (e.g., directory prefixes, current environment (dev, prod), current server name, etc.). Would like to be able to pass in a project name to allow some automatic customization of directory paths
  • For this, why not create config object, similar to what you are already doing. However, instead of trying to pass the project name in during the use My::LocalConfig qw(project_name);, do something like this:

    use My::LocalConfig; my $local_config = new My::LocalConfig '<project>';
    Then, within your new method, you can customize some of the directory paths.

  • be able to load app-specific info, and use variables from the shared info to do it (e.g., use a path from the shared info to tell me where to find my app-specific config file on a given system)
  • Following along the same path as before, we can now use an object to clarify app-specific info. Since information from the machine config is necessary, it can again be passed into the new method of your app-specific config object.

    require "$local_config->{CONFIG_PATH}/"; my $app_config = new AppConfig $local_config;

  • load 'session scoped' info appropriately with a layer of abstraction so apps aren't directly using $ENV{REMOTE_USER}; I want a layer because depending on the auth system we use, the current username might be in REMOTE_USER or SOME_OTHER_ENV and I'd like to abstract that from direct use by apps
  • For session information I would suggest using a module such as CGI::Session or Apache::Session. I have used CGI::Session before and found it quite nice, but never under a mod_perl environment. The documentation for CGI::Session did not mention anything about mod_perl, but the documentation for Apache::Session says the following: "Apache::Session is designed to work with Apache and mod_perl, but it should work under CGI and other web servers, and it also works outside of a web server altogether."

I hope this helps in your search for configuration options.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2019-12-14 03:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found