I'm setting an Catalyst webapp for deploy and would like to remove the -Debug and StackTrace Catalyst plugins from my app.pm in production environment. However, since I keep a testing environment, I'd like to avoid "hardcoding" this. Instead, I'd like to have a config variable defining the environment and load the modules accordingly. All source is on SVN and it would get messy if I were to update the repo and then manually change the modules I load in the app.pm.
The app currently uses configLoader module to read a local_app.yml file with all configs, which is unversioned and allows some control over the way the app works in either dev, test or prod environments; but these are only read after the application is started (hence, after the modules have been loaded).
Here's a simplification of the app.pm:
package app;
use strict;
use warnings;
use Hash::Merge ();
use Sys::Hostname;
use Catalyst::Runtime '5.80';
use Catalyst qw/
-Debug
StackTrace
ConfigLoader
SomeOtherModule
AndYetAnotherOne
/;
__PACKAGE__->config(
# Some local config stuff
);
# Start the application
__PACKAGE__->setup();
Is there a way to do this without having to use a Unix command to find out which host is running the app?