mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 07:02:36 +00:00
showcase using env vars
This commit is contained in:
parent
e5ef94ded8
commit
4074fcf83c
3 changed files with 27 additions and 14 deletions
|
|
@ -295,11 +295,17 @@ def replace_env_vars(config: Any, path: str = "") -> Any:
|
|||
env_var = match.group(1)
|
||||
default_val = match.group(2)
|
||||
|
||||
if env_var not in os.environ:
|
||||
if default_val is None:
|
||||
if default_val is None:
|
||||
if env_var not in os.environ:
|
||||
raise EnvVarError(env_var, path)
|
||||
return default_val
|
||||
return os.environ[env_var]
|
||||
value = os.environ[env_var]
|
||||
else:
|
||||
# use the default if env var is "nullish"
|
||||
value = os.environ.get(env_var)
|
||||
if not value:
|
||||
value = default_val
|
||||
|
||||
return value
|
||||
|
||||
try:
|
||||
return re.sub(pattern, get_env_var, config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue