Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inheriting config file settings in pyramid

Is a setup like this not possible?

production.ini file:

[app:main]
use = egg:my_project

 ... various settings ...

[server:main]
...

development.ini file:

[app:main]
use = config:production.ini#main

... override some production settings ...

Then I try starting my development server and get:

No section 'main' (prefixed by 'server') found in config development.ini

I'd like to chain my config files together like so:

production.ini -> development.ini -> local.ini -> test.ini

It seems like this should be possible, but I haven't gotten the magic right yet.

like image 610
lostdorje Avatar asked Oct 23 '11 05:10

lostdorje


1 Answers

It is possible to inherit INI files, but the inheritance only works on a section-by-section basis. So if you don't explicitly tell "test.ini" to inherit the [server:main] section, then it won't. The docs on all of this are via the PasteDeploy package although it's not entirely obvious.

I've never actually seen an inheritance chain for the [server] section, but it may be possible... usually you just see that done with [app] sections. I wouldn't be surprised if you had to duplicate that section between files.

As a side note, the logging configuration in an INI file is not inheritable... that's not actually controlled by PasteDeploy at all so you'd have to duplicate it in each file.

like image 185
Michael Merickel Avatar answered Oct 12 '22 01:10

Michael Merickel