Re: [Catalyst] Working with project configuration file outsideofCatalyst directory

2010-09-01 Thread Octavian Rasnita
Hi Leandro,

If you use Config::General style configuration files, search for include 
string in the POD documentation of Config::General module and you will find the 
syntax used for including another config file.

For example, if you want to include the file external.conf in a certain place 
in another configuration file, you can use:

include external.conf

Octavian

- Original Message - 
From: Leandro Hermida soft...@leandrohermida.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, September 01, 2010 9:51 PM
Subject: Re: [Catalyst] Working with project configuration file 
outsideofCatalyst directory


Hi Octavian,

Thank you for the information, I am a bit confused how to implement it
though, what do you mean include that configuration file in both the
master configuration and Catalyst configuration files?

Suppose I have my master project directory:

myproject/
lib/
... other dirs...
myproject.conf
web/   Catalyst application directory
inc/
lib/
myproject_web.conf
script/
t/

In myproject.conf I would have the database connection info amongst
other configuration used by the overall project:

DB
schema_class ...
connect_info
dsn ...
username ...
password ...
AutoCommit 1
/connect_info
/DB

In the Catalyst configuration myproject_web.conf I would have things
specific to Catalyst:

name MyApp::Web
default_view HTML


How would I have Catalyst be able to include the configuration
automatically from myproject.conf outside the Catalyst app dir?

best,
Leandro


On Wed, Sep 1, 2010 at 7:25 PM, Octavian Rasnita orasn...@gmail.com wrote:
 There may be other ways, but you could create a separate configuration file 
 that contains the database connection settings only and include that 
 configuration file in both the master configuration and Catalyst 
 configuration files.
 If you'll want to change the database connection settings, you will need to 
 change it in a single place.

 Octavian

 - Original Message -
 From: Leandro Hermida soft...@leandrohermida.com
 To: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Sent: Wednesday, September 01, 2010 7:49 PM
 Subject: [Catalyst] Working with project configuration file outside 
 ofCatalyst directory


 Dear all,

 My apologies if I haven't seen the post with the answer, I've looked
 all over and get explanations for not exactly the same thing. I have a
 big project of which the Catalyst application is only a part. I want
 a master configuration file for the project which has configuration of
 things independent of Catalyst (e.g. the database connection and
 related info) and of course this configuration file lives outside of
 the Catalyst application directory. Catalyst will have its
 configuration file in the application directory e.g. my_app.conf and
 this file with have only configuration related to Catalyst and I
 Catalyst to be able to draw from the master project configuration file
 outside to get for example onfiguration for connecting to the database
 because this shouldn't be in my_app.conf.

 Configuration shouldn't be anywhere twice and project code outside the
 Catalyst sub-project shouldn't have any knowledge of Catalyst at all
 and shouldn't go get configuration inside Catalyst, it should be the
 other way around (the only explanations I've seen take the former
 approach). Is there a way to do this?

 best,
 Leandro

 ___
 List: Catalyst@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/

 ___
 List: Catalyst@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/


___
List: Catalyst@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/

___
List: Catalyst@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/


Re: [Catalyst] Working with project configuration file outsideofCatalyst directory

2010-09-01 Thread Leandro Hermida
Hi there,

Thank you I did not see that!  For others it is here:

http://search.cpan.org/~tlinden/Config-General-2.49/General.pm#INCLUDES

Which brings the second question, now that one includes this
configuration from the parent project, e.g. the database connection
info, how will the Catalyst model for this DB properly pick it up?
Catalyst::Model::DBIC::Schema expects to find it in tags starting with
Model e.g. Model::DB and it won't be like this for the parent
configuration. Is there a way for Catalyst::Model::DBIC::Schema to
read from a different config section?

best,
Leandro

On Wed, Sep 1, 2010 at 9:20 PM, Octavian Rasnita orasn...@gmail.com wrote:
 Hi Leandro,

 If you use Config::General style configuration files, search for include 
 string in the POD documentation of Config::General module and you will find 
 the syntax used for including another config file.

 For example, if you want to include the file external.conf in a certain place 
 in another configuration file, you can use:

 include external.conf

 Octavian

 - Original Message -
 From: Leandro Hermida soft...@leandrohermida.com
 To: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Sent: Wednesday, September 01, 2010 9:51 PM
 Subject: Re: [Catalyst] Working with project configuration file 
 outsideofCatalyst directory


 Hi Octavian,

 Thank you for the information, I am a bit confused how to implement it
 though, what do you mean include that configuration file in both the
 master configuration and Catalyst configuration files?

 Suppose I have my master project directory:

 myproject/
    lib/
    ... other dirs...
    myproject.conf
    web/   Catalyst application directory
        inc/
        lib/
        myproject_web.conf
        script/
        t/

 In myproject.conf I would have the database connection info amongst
 other configuration used by the overall project:

 DB
    schema_class ...
    connect_info
        dsn ...
        username ...
        password ...
        AutoCommit 1
    /connect_info
 /DB

 In the Catalyst configuration myproject_web.conf I would have things
 specific to Catalyst:

 name MyApp::Web
 default_view HTML
 

 How would I have Catalyst be able to include the configuration
 automatically from myproject.conf outside the Catalyst app dir?

 best,
 Leandro


 On Wed, Sep 1, 2010 at 7:25 PM, Octavian Rasnita orasn...@gmail.com wrote:
 There may be other ways, but you could create a separate configuration file 
 that contains the database connection settings only and include that 
 configuration file in both the master configuration and Catalyst 
 configuration files.
 If you'll want to change the database connection settings, you will need to 
 change it in a single place.

 Octavian

 - Original Message -
 From: Leandro Hermida soft...@leandrohermida.com
 To: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Sent: Wednesday, September 01, 2010 7:49 PM
 Subject: [Catalyst] Working with project configuration file outside 
 ofCatalyst directory


 Dear all,

 My apologies if I haven't seen the post with the answer, I've looked
 all over and get explanations for not exactly the same thing. I have a
 big project of which the Catalyst application is only a part. I want
 a master configuration file for the project which has configuration of
 things independent of Catalyst (e.g. the database connection and
 related info) and of course this configuration file lives outside of
 the Catalyst application directory. Catalyst will have its
 configuration file in the application directory e.g. my_app.conf and
 this file with have only configuration related to Catalyst and I
 Catalyst to be able to draw from the master project configuration file
 outside to get for example onfiguration for connecting to the database
 because this shouldn't be in my_app.conf.

 Configuration shouldn't be anywhere twice and project code outside the
 Catalyst sub-project shouldn't have any knowledge of Catalyst at all
 and shouldn't go get configuration inside Catalyst, it should be the
 other way around (the only explanations I've seen take the former
 approach). Is there a way to do this?

 best,
 Leandro

 ___
 List: Catalyst@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/

 ___
 List: Catalyst@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/


 ___
 List: Catalyst@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

Re: [Catalyst] Working with project configuration file outsideofCatalyst directory

2010-09-01 Thread Mahmoud Mehyar
Hello,

Yes I'm working on the same thing at the moment, since I need the
configuration file to be used with different applications I use yaml config
file because yaml is global

Then you can place your configuration file anywhere and from your main
project module Project.pm

add the following before __PACKAGE__-setup();

__PACKAGE__-config( 'config_file' = [ /new/path/location/Project.yml'] );

You need to delete configuration file from the home directory as this will
not work if the original config file still in the home directory of the
project, this what I've learned after trials and errors :) hope I'm right,
please try
___
List: Catalyst@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/