please correct me if I am wrong, I should be using tool like
YAML/Config::General for application configuration storage and reteieval,
and load them on startup using startup.pl script? That would mean i will
have to store the name of configuration file some where (probabaly in
mod_perl configuration block in httpd.conf).

On Mon, Jul 11, 2011 at 2:26 PM, McCarrell, Jeff <jmcca...@akamai.com>wrote:

>  Hi Jerry.
>
> I went through a couple of different approaches before settling on using
> YAML files to describe configuration.
> There are several nice properties of YAML IMO, not least of which is
> arbitrary nesting so the config can closely match the software being
> configured.
> Here is a sanitized example of my production config:
>
>  # -*- mode: perl -*-
> # configuration file for XXX
> config: { version: 1 }
>
> # XYZ configuration
> #  across the entire XXX tier
> xyz: {
>   # enable / disable all ...
>   feature_X_enabled: true,
>
>   # name of cookie(s) to emit: [xx, yy, zz]
>   emit_cookies: [ xx ]
>
>   # substructure configuration
>   sub_structures: {
>     disabled: {
>       foo: [],
>       bar: [],
>       baz: [],
>     }
>   }
> }
>
> There are several YAML readers available; I preferred YAML::XS because of
> its speed and correctness.
> My apps need to run a long time, so they poll the configuration file every
> n seconds, and reload it if needed.
> Overall, I was pretty happy with this approach, and so were the operations
> folks who have to configure the settings in production.
>
> HTH,
> -- jeff
>
> From: Jerry Pereira <online.je...@gmail.com>
> Date: Mon, 11 Jul 2011 16:07:58 -0500
> To: "modperl@perl.apache.org" <modperl@perl.apache.org>
>
> Subject: Best approach to store Application Configuration
>
> Hi All,
>
> I am new to mod_perl (a java developer). I would like to know the best
> approach to store and retrieve Applicaiton configurations that is accessible
> to all packages in my mod_perl application.
>
> My application configuration includes - Database details, Template mapping,
> LDAP configuration details etc. I would like my to load all these
> configuratoins when my application starts and then on, i should be able to
> access these configuration from anywhere.
>
> For Example:
> my $dbDetails = ConfigUtil->getDBDetails(); //returns reference to hash
> my dbUser = dbDetails->user;
>
> I belive PerlSetVar only allows strings variables. I would like to get some
> suggestions on how configuration management in mod_perl applications.
>
> Thanks,
> Jerry
>



-- 
Your clothes may be the latest in style but you aint completely dressed
until you wear a smile!
Keep smiling : )

Reply via email to