The current API based on custom models works, but it's not extremely elegant.
I think it might be better to pass from a decorator such as:
@from_file(...)
class Config(BaseModel):
foo: int
bar: str
This should automatically add an extra field to gather a config from a file, defined at runtime via CLI.
It could also allow more flexibility, for instance it could allow selecting a model field for that purpose.
The current API based on custom models works, but it's not extremely elegant. I think it might be better to pass from a decorator such as:
This should automatically add an extra field to gather a config from a file, defined at runtime via CLI. It could also allow more flexibility, for instance it could allow selecting a model field for that purpose.