Skip Menu |

This queue is for tickets about the Catalyst-TraitFor-Component-ConfigPerSite CPAN distribution.

Report information
The Basics
Id: 82021
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Catalyst-TraitFor-Component-ConfigPerSite

People
Owner: TEEJAY [...] cpan.org
Requestors: nick [...] webcraftcs.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.06
  • 0.07
  • 0.08
  • 0.09
  • 0.10
Fixed in: 0.12



Subject: Minimum required keys in config file
Date: Sun, 16 Dec 2012 13:45:32 +0000
To: bug-Catalyst-TraitFor-Component-ConfigPerSite [...] rt.cpan.org
From: Nick Anderson <nick [...] webcraftcs.com>
Hi, At present the module Catalyst::TraitFor::Component::ConfigPerSite requires the config file to have at least two keys within each additional <TraitFor::Component::ConfigPerSite> definition, as specified by this line: if (scalar keys %$host_config > 1) { As a result, if only one key is specified, it simply copies the values into the site_config: ($site_config) = values %$host_config; When this single key is actually the Model::DB definition, it will not overwrite the default definition of Model::DB: 'Model::DB' => { 'schema_class' => 'MyApp::Schema', 'connect_info' => { 'max_allowed_packet' => '32MB', 'password' => 'xxxx', 'dsn' => 'dbi:mysql:my_default_db', 'AutoCommit' => '1', 'user' => 'my_default_user' }, }, 'instance_cache_key' => 'my_other_model_db', 'connect_info' => { 'max_allowed_packet' => '32MB', 'password' => 'yyyy', 'dsn' => 'dbi:mysql:my_other_db', 'AutoCommit' => '1', 'user' => 'my_other_user' } As a result, the default Model::DB information will be used. Suggest either: 1. Do not presume that a single key in the definition is not a Model::DB or View::TT definition 2. Ensure that the default keys are overwritten even for the single key case I am unsure as to why you wanted at least two keys in the definition as there will be cases where the user only wants the DB defined (or the View) Not a big issue, but caused me a headache when I seemed to be getting inconsistent results. For now I am adding an additional key to ensure the Model::DB info is used as expected. Regards, Nick
Picking this one up to work on and hopefully sort over this weekend
New version tagged in github with fix and being uploaded to PAUSE now