[Python] Pydantic Dynamic .env Files

Discussão em 'Python' iniciado por Stack, Dezembro 8, 2024.

  1. Stack

    Stack Membro Participativo

    I'm new to pydantic, I want to use it for Settings management in my app, I have a monorepo with some overrides. I wonder what is the "Pydantic" way of initializing the Settings class with a dynamic list of .env files.

    My initial thought was to pass it in the ctor, but I've seen few opinions advising against using ctor with Pydantic.

    the functionality I want to achieve is something like:

    AppSettings that will contain:

    UtilsSettings DataAccessSettings

    all of the 3 will be have a dedicated static default values file and I wish to have another file that will be loaded dynamically and can override the defaults.

    Continue reading...

Compartilhe esta Página