From: Tomas Doran Date: Thu, 14 May 2009 09:22:44 +0000 (+0000) Subject: Explain MYAPP_LOCAL_CONFIG_SUFFIX etc much more clearly, patch from mailing list X-Git-Tag: v0.24~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-ConfigLoader.git;a=commitdiff_plain;h=6a5c6f1945285d8987373511e4b2e8818ba137e1 Explain MYAPP_LOCAL_CONFIG_SUFFIX etc much more clearly, patch from mailing list --- diff --git a/Changes b/Changes index abd9bcc..edbcf79 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Perl extension Catalyst::Plugin::ConfigLoader. 0.24 XXX + - Document CATALYST_CONFIG_LOCAL_SUFFIX and MYAPP_LOCAL_CONFIG_SUFFIX + much better (Louis Erickson) - Fix so that having CATALYST_CONFIG_LOCAL_SUFFIX set in $ENV{} doesn't cause the tests to break. diff --git a/lib/Catalyst/Plugin/ConfigLoader.pm b/lib/Catalyst/Plugin/ConfigLoader.pm index 5240417..c1618e3 100644 --- a/lib/Catalyst/Plugin/ConfigLoader.pm +++ b/lib/Catalyst/Plugin/ConfigLoader.pm @@ -53,7 +53,9 @@ See L's C parameter for more information. To support the distinction between development and production environments, this module will also attemp to load a local config (e.g. myapp_local.yaml) -which will override any duplicate settings. +which will override any duplicate settings. See +L +for details on how this is configured. =head1 METHODS @@ -194,7 +196,8 @@ sub get_config_path { =head2 get_config_local_suffix Determines the suffix of files used to override the main config. By default -this value is C, but it can be specified in the following order of preference: +this value is C, which will load C. The suffix can +be specified in the following order of preference: =over 4 @@ -206,6 +209,13 @@ this value is C, but it can be specified in the following order of prefer =back +The first one of these values found replaces the default of C in the +name of the local config file to be loaded. + +For example, if C< $ENV{ MYAPP_CONFIG_LOCAL_SUFFIX }> is set to C, +ConfigLoader will try and load C instead of +C. + =cut sub get_config_local_suffix { diff --git a/lib/Catalyst/Plugin/ConfigLoader/Manual.pod b/lib/Catalyst/Plugin/ConfigLoader/Manual.pod index 2098a71..5772207 100644 --- a/lib/Catalyst/Plugin/ConfigLoader/Manual.pod +++ b/lib/Catalyst/Plugin/ConfigLoader/Manual.pod @@ -187,5 +187,39 @@ should add the following config information to MyApp.pm: } } ); +=head2 Using a local configuration file + +When ConfigLoader reads configurations, it starts by reading the configuration +file for C with one of the supported extensions as listed +L. + +For example, A L config file is C. + +If a configuration file called C exists with one of the supported +file extensions, it will also be read, and values from that file will +override values from the main config file. + +A L local configuration file would be called +C. + +The C suffix can be changed. See +L for the details of +how. + +This is useful because it allows different people or environments to have +different configuration files. A project with three developers, +I, I, and I as well as a production environment can have +a C, a C, a C, and a +C. + +Each developer, and the web server, would set the environment variable +to load their proper configuration file. All of the configurations can +be stored properly in source control. + +If there is no C, and the individual configuration files contain +something required to start the application, such as the Model's data source +definition, the applicaton won't start unless the environment variable +is set properly. + =cut