Skip to content

Validation only happens one field at a time #56

@robertlagrant

Description

@robertlagrant

Currently, with the following code:

from environs import Env
env = Env()
var1 = env("VAR1")
var2 = env("VAR2")

If both env vars are missing, environs will simply display:

environs.EnvError: Environment variable "VAR1" not set

And only when that's set will it display the second error.

It'd be great to have it validate as far as possible all the required environment variables, perhaps with a manual flagging of when to start and stop such a process:

from environs import Env
env = Env(eager=False)
var1 = env("VAR1")
var2 = env("VAR2")
var3 = env.int("VAR3")
env.read()

environs.EnvError: Environment variables invalid: {"VAR1": "missing", "VAR2": "missing", "VAR3": "wrong type"]. 

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions