Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions graphrag/config/environment_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ def _read_env(

def envvar_prefix(self, prefix: KeyValue):
"""Set the environment variable prefix."""
prefix = read_key(prefix)
prefix = f"{prefix}_".upper()
return self._env.prefixed(prefix)
# Inline read_key logic to avoid function call overhead in hot path
if type(prefix) is str:
effective_prefix = prefix.lower()
else:
effective_prefix = prefix.value.lower()
effective_prefix = f"{effective_prefix}_".upper()
return self._env.prefixed(effective_prefix)

def use(self, value: Any | None):
"""Create a context manager to push the value into the config_stack."""
Expand Down