-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Hi,
confz is very good tool, started to use right now, and found the following:
I created the following config
# config.py
import os
from pathlib import Path
from confz import ConfZ, ConfZFileSource
from pydantic import AnyUrl
my_script_path = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
class APIConfig(ConfZ):
login_page: AnyUrl = "https://abc.com/login"
CONFIG_SOURCES = ConfZFileSource(
folder=Path(my_script_path),
file_from_env='TESTING_API_CONFIG',
optional=True, # because default is added above
)
# config_some_environment.toml
[APIConfig]
login_page = "https://abc.com/login----from_file_just_to_see_the_diff_debug"
# environment variable added
TESTING_API_CONFIG=config_some_environment.tomland the login_page value was the default one. Started to debug it and found, that Toml interpreter creates nested dicts if the file contains table [APIConfig]:
{"APIConfig": {"login_page": "https://abc.com/login----from_file_just_to_see_the_diff_debug"}}and found a call in confz.py line 50:
cls.confz_instance = super().__call__(**config)perhaps this is the point where the nested dict makes the issue. Unfortunately PyCharm did not show the source of super()...
so finished debugging here.
Perhaps this relates a little bit to issue #14
BR,
George
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation