for some reason type hints aren't being interpreted
This commit is contained in:
parent
d680edf7c0
commit
3736844b30
@ -10,6 +10,8 @@ import urllib.parse
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Set, Union
|
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.exceptions import ConfigError
|
||||||
from reflex.utils.types import value_inside_optional
|
from reflex.utils.types import value_inside_optional
|
||||||
|
|
||||||
@ -253,6 +255,8 @@ class EnvironmentVariables:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize the environment variables."""
|
"""Initialize the environment variables."""
|
||||||
|
type_hints = get_type_hints(type(self))
|
||||||
|
|
||||||
for field in dataclasses.fields(self):
|
for field in dataclasses.fields(self):
|
||||||
raw_value = os.getenv(field.name, None)
|
raw_value = os.getenv(field.name, None)
|
||||||
|
|
||||||
@ -262,6 +266,8 @@ class EnvironmentVariables:
|
|||||||
else get_default_value_for_field(field)
|
else get_default_value_for_field(field)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
field.type = type_hints[field.name] or field.type
|
||||||
|
|
||||||
setattr(self, field.name, value)
|
setattr(self, field.name, value)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user