r/FastAPI • • Aug 28 '24

Question [HELP] Pydantic - Setting Class

Hi, I need to read lists from a .env file for the following settings:

class Settings(BaseSettings):
    ...
    ldap_search_bases: List[str]
    ldap_ou_to_avoid: List[str]
    ldap_attr_to_retrieve: List[str]

How can I set these lists in the .env file?

For example:

LDAP_OU_TO_AVOID = ["OU=Buzones Genericos"]
3 Upvotes

3 comments sorted by