[Catalyst] Best practice for configuration file placement

Morad IGMIR migmir at alliancemca.com
Fri May 18 08:21:13 GMT 2012


Hello,

If you're using Config::General, a good way to do this is to use the
-UseApacheInclude option when setting up your config object in lib/MyApp.pm.

In your conf file you then have to make sure the last line is :

include /etc/myapp.conf 
# or whatever the path you want is

That way you can forget about the conf file in the module directory and use
the one in /etc (or wherever you put it) instead

You can also use the -IncludeGlob option if you want to be able to have more
than one file included as such : 
Include /etc/myapp*.conf
# will read /etc/myapp_db.conf , /etc/myapp_log.conf, etc.


Here is a relevant bit from one of my cat apps' lib/MyApp.pm : 

__PACKAGE__->config(
		'Plugin::ConfigLoader' => {
			driver => {
				'General' => { 
					-MergeDuplicateBlocks => 1,
					-MergeDuplicateOptions => 1,
					-IncludeGlob => 1,
					-UseApacheInclude => 1,
					-UTF8 => 1,
				 },
			}
		},
);

-----Message d'origine-----
De : Luis Muñoz [mailto:luisemunoz at gmail.com] 
Envoyé : jeudi 17 mai 2012 06:25
À : John Napiorkowski; The elegant MVC web framework
Objet : Re: [Catalyst] Best practice for configuration file placement


On May 17, 2012, at 12:02 AM, John Napiorkowski wrote:

> I would think you could build something into the makefile.PL that would
copy this stuff to /etc for production.  

Well, in my case I'm using a .deb that will place the vanilla config file in
the /etc dir. However I want to make sure that this is where the
ConfigLoader plugin will look. I'll try and use the snippet you provided
(should work according to docs).

Thanks!

-lem


_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list