python-config2 icon indicating copy to clipboard operation
python-config2 copied to clipboard

how to use multiple config file in one enviroment

Open konerld opened this issue 5 years ago • 1 comments

Sorry, cant find contact to write PM As i understand the one file for one environment But is it possible to load multiple file in default enviroment?

if I use: from config2.config import config config.values

it return values from all enviroment but this is not able with using dict keys as method

is it possible?

thanks

konerld avatar Mar 05 '20 10:03 konerld

FWIW, that's not possible. I don't see a use case for that as well, to be honest. The purpose of different config files for different environments in general is to override arbitrary configuration values from default.yml depending on the environment your application runs in.

if I use: from config2.config import config config.values

it return values from all enviroment but this is not able with using dict keys as method

is it possible?

I don't really understand your question. Assuming that you define a values property in default.yml, if the ENV environment variable is not set, config.values should only contain the values field from default.yml. Let's say you set ENV to production. If a production.yml config file exists then, config will contain the contents of default.yml, merged with the contents of production.yml. In case values is set in production.yml as well, config.values will then contain the values field from default.yml, recursively replaced/extended by the contents of values in production.yml. Otherwise, config.values will remain as specified in default.yml. Does this clarify things for you?

bjoluc avatar May 25 '20 13:05 bjoluc