Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sub-module config env_name path missing BAT_ prefix #2

Open
lundybernard opened this issue Jul 8, 2021 · 0 comments
Open

sub-module config env_name path missing BAT_ prefix #2

lundybernard opened this issue Jul 8, 2021 · 0 comments

Comments

@lundybernard
Copy link
Owner

When you have a sub_config

conf = get_config(GlobalConfig)
sub_config = conf.my_module
print(sub_config.item)

We expect the ENV path for an item to be BAT_MY_MODULE_ITEM
however, batconf.sources.env.py: EnvConfig currently looks for MY_MODULE_ITEM

We should also handle sub-modules recursively, for instance
conf.my_module.sub_module.item should lookup BAT_MY_MODULE_SUB_MODULE_ITEM
whether regardless of which config we look it up from:

conf = get_config(GlobalConfig)
print(conf.mod_config.sub_mod_config.item)
mod_config = conf.my_module
print(mod_config.sub_mod_config.item)
sub_mod_config = mod_config.sub_module
print(sub_mod_config.item)

should all lookup the same ENV variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant