From f4dd7b50838f420c6bfc2e079f75b4eea8aadcea Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Tue, 29 Oct 2024 11:14:20 -0700 Subject: [PATCH] use flag instead of dict --- reflex/config.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/reflex/config.py b/reflex/config.py index ef0524ded..9cc01024e 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -303,7 +303,11 @@ def interpret_env_var_value( ) -ExistingPath = Annotated[Path, {"exists": True}] +class PathExistsFlag: + """Flag to indicate that a path must exist.""" + + +ExistingPath = Annotated[Path, PathExistsFlag] @dataclasses.dataclass(init=False) @@ -336,7 +340,7 @@ class EnvironmentVariables: # Path to the alembic config file ALEMBIC_CONFIG: ExistingPath = dataclasses.field( - default_factory=lambda: ExistingPath(constants.ALEMBIC_CONFIG) + default_factory=lambda: Path(constants.ALEMBIC_CONFIG) ) # Disable SSL verification for HTTPX requests. @@ -450,7 +454,7 @@ class Config(Base): telemetry_enabled: bool = True # The bun path - bun_path: ExistingPath = ExistingPath(constants.Bun.DEFAULT_PATH) + bun_path: ExistingPath = Path(constants.Bun.DEFAULT_PATH) # List of origins that are allowed to connect to the backend API. cors_allowed_origins: List[str] = ["*"] @@ -574,7 +578,7 @@ class Config(Base): ) # Interpret the value. - value = interpret_env_var_value(env_var, field.type_, field.name) + value = interpret_env_var_value(env_var, field.outer_type_, field.name) # Set the value. updated_values[key] = value