Skip to content

Commit 701065b

Browse files
authored
Merge pull request #385 from omertuc/varrep
Support configuration env variable replacement
2 parents 2004d97 + af75acc commit 701065b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/configuration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import logging
44
from typing import Any, Optional
55

6+
# We want to support environment variable replacement in the configuration
7+
# similarly to how it is done in llama-stack, so we use their function directly
8+
from llama_stack.core.stack import replace_env_vars
9+
610
import yaml
711
from models.config import (
812
Configuration,
@@ -16,6 +20,7 @@
1620
DatabaseConfiguration,
1721
)
1822

23+
1924
logger = logging.getLogger(__name__)
2025

2126

@@ -38,6 +43,7 @@ def load_configuration(self, filename: str) -> None:
3843
"""Load configuration from YAML file."""
3944
with open(filename, encoding="utf-8") as fin:
4045
config_dict = yaml.safe_load(fin)
46+
config_dict = replace_env_vars(config_dict)
4147
logger.info("Loaded configuration: %s", config_dict)
4248
self.init_from_dict(config_dict)
4349

0 commit comments

Comments
 (0)