Skip to content

consider a choices parser #253

Closed
@willkg

Description

@willkg

I've had several situations where I want a parser that requires the value to be one of a list of possible values. I'd like to do something like:

from everett.manager import ConfigManager

config = ConfigManager.basic_config()

CLOUD_PROVIDER = config(
    "CLOUD_PROVIDER",
    default="AWS",
    parser=OneOf(["AWS", "GCP"]),
)

and then have that work for "AWS" and "GCP" and raise aValueError specifying one of the valid values for everything else.

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