List Info

Thread: Zend_Config question




Zend_Config question
user name
2007-03-29 09:38:39
I was wondering if it is possible with Zend_Config to do
Apache-style
loading of configuration files.  By this, I mean is it
possible to
have a directive in a Zend_Config_Ini file that says
"load any .ini
files that are in directory X", much like how you can
ask Apache2 to
load any configuration files in a specific directory.

Right now I have a layout like this:

project/application/config/config.ini

what I'd like is to be able to do the following

project/application/config/global_config.ini (used by
multiple
projects, doesn't change)
project/application/config/project/config.ini
(project-specific
config, will be very different)

The goal is to make configuration follow a DRY principle. 
By some
judicious use of svn externals, I will only ever have to
edit the
project-specific config.ini file while the global_config.ini
file only
has to be maintained in one spot.

Hopefully I've explained this properly.

-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

rallyhat.com - digital photo scavenger hunt
TheBallpark - http://www.li
ttlehart.net/attheballpark
TheKeyboard - http://www.li
ttlehart.net/atthekeyboard

Re: Zend_Config question
user name
2007-03-29 10:16:33
Hi Chris,

Maybe you would like to comment on ZF-988?

http:/
/framework.zend.com/issues/browse/ZF-998

Though your use case may not be quite the same, I believe
there is some
overlap where we consider merging configurations.

Thanks for the feedback!

Best regards,
Darby

Chris Hartjes wrote:
> I was wondering if it is possible with Zend_Config to
do Apache-style
> loading of configuration files.  By this, I mean is it
possible to
> have a directive in a Zend_Config_Ini file that says
"load any .ini
> files that are in directory X", much like how you
can ask Apache2 to
> load any configuration files in a specific directory.
> 
> Right now I have a layout like this:
> 
> project/application/config/config.ini
> 
> what I'd like is to be able to do the following
> 
> project/application/config/global_config.ini (used by
multiple
> projects, doesn't change)
> project/application/config/project/config.ini
(project-specific
> config, will be very different)
> 
> The goal is to make configuration follow a DRY
principle.  By some
> judicious use of svn externals, I will only ever have
to edit the
> project-specific config.ini file while the
global_config.ini file only
> has to be maintained in one spot.
> 
> Hopefully I've explained this properly.
> 

Re: Zend_Config question
user name
2007-03-29 12:09:57
Well, the two cases are different.  This proposal talks
about merging
two config files together where you already know the names
of the
configuration files.

I'm looking for the ability to load a number of smaller
configuration
files without having to actually worry what they are
actually called.

If the person who is maintaining Zend_Config wants to
contact me, I
might be able to get some support from my boss to fund this
change...



On 3/29/07, Darby Felton <darbyzend.com> wrote:
> Hi Chris,
>
> Maybe you would like to comment on ZF-988?
>
> http:/
/framework.zend.com/issues/browse/ZF-998
>
> Though your use case may not be quite the same, I
believe there is some
> overlap where we consider merging configurations.
>
> Thanks for the feedback!
>
> Best regards,
> Darby
>
> Chris Hartjes wrote:
> > I was wondering if it is possible with Zend_Config
to do Apache-style
> > loading of configuration files.  By this, I mean
is it possible to
> > have a directive in a Zend_Config_Ini file that
says "load any .ini
> > files that are in directory X", much like how
you can ask Apache2 to
> > load any configuration files in a specific
directory.
> >
> > Right now I have a layout like this:
> >
> > project/application/config/config.ini
> >
> > what I'd like is to be able to do the following
> >
> > project/application/config/global_config.ini (used
by multiple
> > projects, doesn't change)
> > project/application/config/project/config.ini
(project-specific
> > config, will be very different)
> >
> > The goal is to make configuration follow a DRY
principle.  By some
> > judicious use of svn externals, I will only ever
have to edit the
> > project-specific config.ini file while the
global_config.ini file only
> > has to be maintained in one spot.
> >
> > Hopefully I've explained this properly.
> >
>


-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

rallyhat.com - digital photo scavenger hunt
TheBallpark - http://www.li
ttlehart.net/attheballpark
TheKeyboard - http://www.li
ttlehart.net/atthekeyboard

Re: Re: Zend_Config question
user name
2007-03-29 13:57:06
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Hartjes wrote:
> Well, the two cases are different.  This proposal talks
about merging
> two config files together where you already know the
names of the
> configuration files.
> 

Yes. I agree.


> I'm looking for the ability to load a number of smaller
configuration
> files without having to actually worry what they are
actually called.

My initial instinct that this would add too much complexity
to and
exceed the responsibily of Zend_Config_Ini which has a
one-to-one
relationship with an ini file.

The obvious solutions are to use some userland code to load
each one
separately and then merge. Alternatively, if there there is
a lot of
requirement for this sort of loading of configuration files,
then maybe
a Zend_Config_Loader class would make sense?


Regards,

Rob...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFGDAwC421+qn4cITwRAvd4AJ9LDA3SUwdKd/G1Hs5UCRsix0L+YgCf
RTT7
pmLbWo4epL0UPTgTLgiCerM=
=MDu+
-----END PGP SIGNATURE-----

Re: Zend_Config question
user name
2007-03-29 14:35:22
If a Zend_Config_Loader component can do some sort of wild
card
loading, that would perfectly meet my needs.  

Thanks for the quick responses.


On 3/29/07, Rob Allen <robakrabat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Chris Hartjes wrote:
> > Well, the two cases are different.  This proposal
talks about merging
> > two config files together where you already know
the names of the
> > configuration files.
> >
>
> Yes. I agree.
>
>
> > I'm looking for the ability to load a number of
smaller configuration
> > files without having to actually worry what they
are actually called.
>
> My initial instinct that this would add too much
complexity to and
> exceed the responsibily of Zend_Config_Ini which has a
one-to-one
> relationship with an ini file.
>
> The obvious solutions are to use some userland code to
load each one
> separately and then merge. Alternatively, if there
there is a lot of
> requirement for this sort of loading of configuration
files, then maybe
> a Zend_Config_Loader class would make sense?
>
>
> Regards,
>
> Rob...
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

>
>
iD8DBQFGDAwC421+qn4cITwRAvd4AJ9LDA3SUwdKd/G1Hs5UCRsix0L+YgCf
RTT7
> pmLbWo4epL0UPTgTLgiCerM=
> =MDu+
> -----END PGP SIGNATURE-----
>


-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

rallyhat.com - digital photo scavenger hunt
TheBallpark - http://www.li
ttlehart.net/attheballpark
TheKeyboard - http://www.li
ttlehart.net/atthekeyboard

Re: Re: Zend_Config question
user name
2007-03-29 14:41:20
On Thu, March 29, 2007 11:57 am, Rob Allen wrote:
> My initial instinct that this would add too much
complexity to and
> exceed the responsibily of Zend_Config_Ini which has a
one-to-one
> relationship with an ini file.
>
> The obvious solutions are to use some userland code to
load each one
> separately and then merge. Alternatively, if there
there is a lot of
> requirement for this sort of loading of configuration
files, then maybe
> a Zend_Config_Loader class would make sense?

A better solution would be to rename Zend_Config to
Zend_Config_Array,
which is a better description of what it does.  Then make
Zend_Config a
top-level configuration loading class that auto-detects the
appropriate
adapter for any given file based on extension, loads all
files in a given
set of directories, and merges them as necessary.

-Matt


Re: Re: Zend_Config question
user name
2007-03-29 14:45:05
+1, I kinda always thought thats what the Zend_Config class
should do. 
That architecture also lends itself to the 'simplicity' of
use in the 
Framework.

ralph

Matthew Ratzloff wrote:
> On Thu, March 29, 2007 11:57 am, Rob Allen wrote:
>> My initial instinct that this would add too much
complexity to and
>> exceed the responsibily of Zend_Config_Ini which
has a one-to-one
>> relationship with an ini file.
>>
>> The obvious solutions are to use some userland code
to load each one
>> separately and then merge. Alternatively, if there
there is a lot of
>> requirement for this sort of loading of
configuration files, then maybe
>> a Zend_Config_Loader class would make sense?
> 
> A better solution would be to rename Zend_Config to
Zend_Config_Array,
> which is a better description of what it does.  Then
make Zend_Config a
> top-level configuration loading class that auto-detects
the appropriate
> adapter for any given file based on extension, loads
all files in a given
> set of directories, and merges them as necessary.
> 
> -Matt
> 
> 


Re: Re: Zend_Config question
user name
2007-03-29 15:00:25
On 3/29/07, Matthew Ratzloff <mattbuiltfromsource.com>
wrote:
>
> A better solution would be to rename Zend_Config to
Zend_Config_Array,
> which is a better description of what it does.  Then
make Zend_Config a
> top-level configuration loading class that auto-detects
the appropriate
> adapter for any given file based on extension, loads
all files in a given
> set of directories, and merges them as necessary.
>
> -Matt
>

That is *exactly* what I would require.  Nicely done.


-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

rallyhat.com - digital photo scavenger hunt
TheBallpark - http://www.li
ttlehart.net/attheballpark
TheKeyboard - http://www.li
ttlehart.net/atthekeyboard

Re: Re: Zend_Config question
user name
2007-03-30 06:07:47
Matthew Ratzloff wrote:
> 
> A better solution would be to rename Zend_Config to
Zend_Config_Array,
> which is a better description of what it does.  Then
make Zend_Config a
> top-level configuration loading class that auto-detects
the appropriate
> adapter for any given file based on extension, loads
all files in a given
> set of directories, and merges them as necessary.

What you are calling Zend_Config, I would call
Zend_Config_Loader. The
principle is fine though.

Regards,

Rob...

[1-9]

about | contact  Other archives ( Real Estate discussion Medical topics )