Skip to content

Loading env variable with empty prefix fails #180

@ykrasik

Description

@ykrasik

Hi,

@dataclass
class Test:
    my_var: str

dataconf.env("").on(Test)

The above will fail in the environment contains a key of the format xxx_{int}=... i.e. a string, an underscore and a number that can be parsed as an int.
This line then considers p[1] to be an int, but focus does not contain the key p[0] at all and we get a Key error.

For example, my env contains 'EFC_5748': '1'. The above line is executed with these values:
p = ['efc', 5748]
focus = ret

focus does not contain the key efc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions