Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's the best Perl module for hierarchical and inheritable configuration?
    text
    copied!<p>If I have a greenfield project, what is the best practice Perl based configuration module to use?</p> <p>There will be a Catalyst app and some command line scripts. They should share the same configuration.</p> <p>Some features I think I want ...</p> <p>Hierarchical Configurations to cleanly maintain different development and live settings. </p> <p>I'd like to define "global" configurations once (eg, results_per_page => 20), have those inherited but override-able by my dev/live configs. </p> <pre><code>Global: results_per_page: 20 db_dsn: DBI:mysql; db_name: my_app Dev: inherit_from: Global db_user: dev db_pass: dev Dev_New_Feature_Branch: inherit_from: Dev db_name: my_app_new_feature Live: inherit_from: Global db_user: live db_pass: secure </code></pre> <p>When I deploy a project to a new server, or branch/fork/copy it somewhere new (eg, a new development instance), I want to (one time only) set which configuration set/file to use, and then all future updates are automatic.</p> <p>I'd envisage this could be achieved with a symlink:</p> <pre><code>git clone example.com:/var/git/my_project . # or any equiv vcs cd my_project/etc ln -s live.config to_use.config </code></pre> <p>Then in the future</p> <pre><code>git pull # or any equiv vcs </code></pre> <p>I'd also like something that akin to FindBin, so that my configs can either use absolute paths, or relative to the current deployment. Given</p> <pre><code>/home/me/development/project/ bin lib etc/config </code></pre> <p>where /home/me/development/project/etc/config contains:</p> <pre><code>tmpl_dir: templates/ </code></pre> <p>when my perl code looks up the tmpl_dir configuration it'll get:</p> <pre><code>/home/me/development/project/templates/ </code></pre> <p>But on the live deployment:</p> <pre><code>/var/www/project/ bin lib etc/config </code></pre> <p>The same code would magically return</p> <pre><code>/var/www/project/templates/ </code></pre> <p>Absolute values in the config should be honoured, so that:</p> <pre><code>apache_config: /etc/apache2/httpd.conf </code></pre> <p>would return "/etc/apache2/httpd.conf" in all cases.</p> <p>Rather than a FindBin style approach, an alternative might be to allow configuration values to be defined in terms of other configuration values?</p> <pre><code>tmpl_dir: $base_dir/templates </code></pre> <p>I'd also like a pony ;)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload