MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / replacer

Function replacer

api/config.py:82–92  ·  view source on GitHub ↗
(match: re.Match[str])

Source from the content-addressed store, hash-verified

80 pattern = re.compile(r"\$\{([A-Z0-9_]+)\}")
81
82 def replacer(match: re.Match[str]) -> str:
83 env_var_name = match.group(1)
84 original_placeholder = match.group(0)
85 env_var_value = os.environ.get(env_var_name)
86 if env_var_value is None:
87 logger.warning(
88 f"Environment variable placeholder '{original_placeholder}' was not found in the environment. "
89 f"The placeholder string will be used as is."
90 )
91 return original_placeholder
92 return env_var_value
93
94 if isinstance(config, dict):
95 return {k: replace_env_placeholders(v) for k, v in config.items()}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected