mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-14 17:16:09 +00:00
fix: allow default empty vars for conditionals (#2570)
# What does this PR do? We were not using conditionals correctly, conditionals can only be used when the env variable is set, so `${env.ENVIRONMENT:+}` would return None is ENVIRONMENT is not set. If you want to create a conditional value, you need to do `${env.ENVIRONMENT:=}`, this will pick the value of ENVIRONMENT if set, otherwise will return None. Closes: https://github.com/meta-llama/llama-stack/issues/2564 Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
faaeccc6fd
commit
25268854bc
61 changed files with 236 additions and 211 deletions
|
@ -125,7 +125,7 @@ config:
|
|||
```
|
||||
|
||||
If the environment variable is not set, the default value `http://localhost:11434` will be used.
|
||||
Empty defaults are not allowed so `url: ${env.OLLAMA_URL:=}` will raise an error if the environment variable is not set.
|
||||
Empty defaults are allowed so `url: ${env.OLLAMA_URL:=}` will be set to `None` if the environment variable is not set.
|
||||
|
||||
#### Conditional Values
|
||||
|
||||
|
@ -139,8 +139,10 @@ config:
|
|||
|
||||
If the environment variable is set, the value after `:+` will be used. If it's not set, the field
|
||||
will be omitted with a `None` value.
|
||||
So `${env.ENVIRONMENT:+}` is supported, it means that the field will be omitted if the environment
|
||||
variable is not set. It can be used to make a field optional and then enabled at runtime when desired.
|
||||
|
||||
Do not use conditional values (`${env.OLLAMA_URL:+}`) for empty defaults (`${env.OLLAMA_URL:=}`).
|
||||
This will be set to `None` if the environment variable is not set.
|
||||
Conditional must only be used when the environment variable is set.
|
||||
|
||||
#### Examples
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue