alexferl/vyper

Robust handling of nested field.

jperkelens opened this issue · 0 comments

Currently, the _find method resolves config values in priority order. However, it does not treat nested value robustly. Plenty of work has been done to support env binding support for nested config values. However, overrides & defaults will not respect nesting unless retrieved from the level in which they were set.

Example:

config:
     file_settings:
          name: cool_file
          permissions: rw
vyper.read_in_config(config.yaml)
vyper.set_default("config.file_settings.extension" , "txt")
vyper.set("config.file_settings.permissions" , "r")

vyper.get("config.file_settings.extension") # Returns: "txt"
vyper.get("config.file_settings.permissions") # Returns: "r"
vyper.get("config.file_settings") # Returns: { name: cool_file, permissions: rw }

The complexity of managing this in the _find method seems untenable and the library seems to be calling for some sort of composable, self referential construct built on config read to handle this appropriately. These are nascent thought but I'll try to work through a POC over the weekend.