MCPcopy
hub / github.com/TaskingAI/TaskingAI / load_str_env

Function load_str_env

plugin/config.py:19–32  ·  view source on GitHub ↗

Load environment variable as string :param name: name of the environment variable :param required: whether the environment variable is required

(name: str, required: bool = False)

Source from the content-addressed store, hash-verified

17
18
19def load_str_env(name: str, required: bool = False) -> str:
20 """
21 Load environment variable as string
22 :param name: name of the environment variable
23 :param required: whether the environment variable is required
24 """
25 if os.environ.get(name):
26 return os.environ.get(name)
27
28 if default_env_values.get(name) is not None:
29 return default_env_values.get(name)
30
31 if required:
32 raise Exception(f"Env {name} is not set")
33
34
35def load_int_env(name: str, required: bool = False) -> int:

Callers 2

load_defaultMethod · 0.90
__init__Method · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected