for some reason type hints aren't being interpreted

This commit is contained in:
Khaleel Al-Adhami 2024-10-16 17:11:52 -07:00
parent d680edf7c0
commit 3736844b30

View File

@ -10,6 +10,8 @@ import urllib.parse
from pathlib import Path
from typing import Any, Dict, List, Optional, Set, Union
from typing_extensions import get_type_hints
from reflex.utils.exceptions import ConfigError
from reflex.utils.types import value_inside_optional
@ -253,6 +255,8 @@ class EnvironmentVariables:
def __init__(self):
"""Initialize the environment variables."""
type_hints = get_type_hints(type(self))
for field in dataclasses.fields(self):
raw_value = os.getenv(field.name, None)
@ -262,6 +266,8 @@ class EnvironmentVariables:
else get_default_value_for_field(field)
)
field.type = type_hints[field.name] or field.type
setattr(self, field.name, value)